Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3401468rwa; Tue, 23 Aug 2022 04:17:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YjcmqUC2HjCzpWVUhBkek/SzC4CswbCqvlfigLdNoaGPPNK/YWPDKSqC2TMtUxrGmBhk/ X-Received: by 2002:a63:1265:0:b0:41d:a571:2805 with SMTP id 37-20020a631265000000b0041da5712805mr20240254pgs.230.1661253443814; Tue, 23 Aug 2022 04:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253443; cv=none; d=google.com; s=arc-20160816; b=bLW9CoPChOGeOfc8C8XjHEaFBh6TntrCRz5eccTJTMN0BZHb/giIySkyyIYwNFOaJ6 cix6Q53tN+RoBvTx0KvStUmzLHzVkq20gQb0yQIKJW8IvwsxnwI8268MMcA59l08oIU/ NF02U3uWc/Jb+35x+XKh8BQ4q9UMFD6XVqY9NI5N2GdjotzFQoYp641CuK8682wFVkl+ OzwbrcwaIzbh9oYVqdxDduf8WcBtJwT6uLaT5kY2xHau3OjGOSENHxGX811atYrE1IEV N8PKz1T4UfZ0VoQuA9Eu5Pqn9UHV9wktbFoNDAmTgzqNCFl0DrBNoteqLUgyPYtkLfpe cfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZPFG+uxJStPGbAul4fqEhzrfvFoHP0DOALrE9yp7Kao=; b=y5vpoIo1RgsChMkd7uHD0AprnIPQPESAbErhKNfdL2JWP7jE07SksG3qnclEZ5D1RI OKK7uRQ/wKVofcjDSUdyKaGwwfFTtwYICabEkn+0af4WTtEQ+Vv8YgOwyXM80KVvUOaQ +C50Wg84fNKY/wT/naqItlM+wECEjuNll6Rw3zBimHl9jyglvltWIW08C/NWPOmiGcxi gQEfwiLgbK6C2atZ58RRhc6ys+ByeSAZLS22r3qJbks75akBreIb9cDC69oIgv0cWPmP nMQjs/qpNSxXk7RqEZMQ9JiPLqAd6xsBPcqQ43HFRe1qLtabepuEaOUt2mCyZptEGG0l eXMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yp5XFjU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a056a00234200b005184ae7a3c4si17516734pfj.140.2022.08.23.04.17.12; Tue, 23 Aug 2022 04:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yp5XFjU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356027AbiHWKlT (ORCPT + 99 others); Tue, 23 Aug 2022 06:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354750AbiHWK0T (ORCPT ); Tue, 23 Aug 2022 06:26:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF9983BEA; Tue, 23 Aug 2022 02:05:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F179A61580; Tue, 23 Aug 2022 09:05:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0C52C433D6; Tue, 23 Aug 2022 09:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245539; bh=64nKZ5znMBqSE8mOqK0YmZCrB6CaXZ+9XWMHssYQUJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yp5XFjU4BSvGN21Y+/hVsgbSMTjCN4SxzeILFRVRqtkeDFQSu2hIdP9tqAN7m6VXd 3Dks5mYQBhxy5knC2F6Z7T+z7c3YGSZFoxwuhOmzLNPARnSIaTn4v4NtFNeb8/b8M3 VH49430fkMF0GxISuPCoe7Fn5kZ13qXpN0eFEckc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.19 103/287] can: pch_can: pch_can_error(): initialize errc before using it Date: Tue, 23 Aug 2022 10:24:32 +0200 Message-Id: <20220823080103.839876678@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Mailhol [ Upstream commit 9950f11211331180269867aef848c7cf56861742 ] After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=2 warning: | In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized] | 501 | cf->data[6] = errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~ Moving errc initialization up solves this issue. Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off") Reported-by: Nathan Chancellor Signed-off-by: Vincent Mailhol Reviewed-by: Nathan Chancellor Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@wanadoo.fr Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 3e1d71c70b0d..25def028a1dc 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -500,6 +500,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) if (!skb) return; + errc = ioread32(&priv->regs->errc); if (status & PCH_BUS_OFF) { pch_can_set_tx_all(priv, 0); pch_can_set_rx_all(priv, 0); @@ -512,7 +513,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->data[7] = (errc & PCH_REC) >> 8; } - errc = ioread32(&priv->regs->errc); /* Warning interrupt. */ if (status & PCH_EWARN) { state = CAN_STATE_ERROR_WARNING; -- 2.35.1