Message ID | 20230306060505.11657-1-i.bornyakov@metrotek.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1687751wrd; Sun, 5 Mar 2023 22:36:05 -0800 (PST) X-Google-Smtp-Source: AK7set8/Ab92f4PU+Lcl1cMuX1vPT4gkEbOm8/S4XMozfIDq6OIv3b3splKtiRNrvxfCFq4hz6RY X-Received: by 2002:a05:6a20:7fa8:b0:cd:1a05:f4f4 with SMTP id d40-20020a056a207fa800b000cd1a05f4f4mr12956575pzj.19.1678084565146; Sun, 05 Mar 2023 22:36:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678084565; cv=none; d=google.com; s=arc-20160816; b=OoCjB9Q4YMOHCfCeJIubu5nF7m+mSyZQvpIhBePl520avI4WDi9R4FeqCON+Qkt+Km GK28ODdRJQbeO6J5uNEJ3YSFle7RZ0lAqvHx8nLXNBTlI7i7mii98tWPOxUoa8m1hcmj YwWoTGclq0d0mn/hA95Lch0xnBxuUk/JpchNDGjbwdyzDUmdb5Yj2D7d4Q/tMzA+5T0m jt2iChOllBDrR6gIyZeA3Dyt4kI6z/xZSlQjp4Z3EnBDVKpvRhZB9tP3kD8i4lUpJDbo mxfkGDWpE8oV11hZjrDzSGhjEhb1xSpu6ZYvDtExkgW50SdXIus/+ZJQOlHRuKWEenxv smgQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=h4Nd+/5LTa2wWreuwHW//LfS88h2YCPrSyzCMogR8iI=; b=X4HV+qe9k3IziWEgCPVpfpawR4C3eHJEH8AZboVKXkHuCENtOoXyS6a7Pg9hlzflXo y8KlRXsXGwa1KNK7ps1TBSvEHpeW8yQSHjyGzKGWT8+n6S64W0Q0IkSMYMKI1XRXKVuA 5ICB/8RdFD1qI2thTrDMNfB5w+aIybuXL9HSq0mbMOiiQxgmEDsNh0yD+0UfbVg30okX FOvAsPNNtpVfsKB06rR0IqgGqF119J39eHgobfUT/KOqgaZ9p2bhUHGIcY+SkrIp+O8C qF1AOWyAo7cQHaqUijN0XB5o08EufgHpPHfu4lCvmPkg+heDMorFdTuffiX2YjwvJe3w RYwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@metrotek.ru header.s=mail header.b=kyyTIpPE; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a65478b000000b004e5833b1fb8si8775421pgs.275.2023.03.05.22.35.52; Sun, 05 Mar 2023 22:36:05 -0800 (PST) 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=fail header.i=@metrotek.ru header.s=mail header.b=kyyTIpPE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbjCFGFs (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 6 Mar 2023 01:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCFGFr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Mar 2023 01:05:47 -0500 Received: from mail.pr-group.ru (mail.pr-group.ru [178.18.215.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C554DBCF; Sun, 5 Mar 2023 22:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=metrotek.ru; s=mail; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding; bh=c/4vBN3nQqBWLIIsDr6bAnmepObZf4pgFEzfOBLDMG0=; b=kyyTIpPE3XvCJ7L1R2x3j76VwU6GDJauqTMQSnPSl+GfeghsVSF2NbQM85Y4F9aovY14NRPdmrLi4 ky5BO6y6f85B8AHFlwJqBTrOj+FjZTfL2Ax4CLY14HWBpLIjnCdC7p44oPOjv18dw0y/NKcMehf9j/ B+mZbg8kABSVLBTr4JSoqK6vVPK8xyzJ1/fHTC5us47RwAd3VtnYMA4vT00U/JdcH6S1NLvvvqNMg3 MRvP4OXj5RPSiha4x//yJ5zKwm+wCZqduUAY3vfoldKEuY7s8ocQUwMBNM/6/fkWbbe7eYwuMP9pdS asaU/lOxtgX3ZbPWlyz3g9IDabmG5/A== X-Kerio-Anti-Spam: Build: [Engines: 2.17.1.1470, Stamp: 3], Multi: [Enabled, t: (0.000009,0.007108)], BW: [Enabled, t: (0.000024,0.000001)], RTDA: [Enabled, t: (0.510061), Hit: No, Details: v2.48.0; Id: 15.gc9bg.1gqqocp1s.2i7; mclb], total: 0(700) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Level: X-Footer: bWV0cm90ZWsucnU= Received: from localhost.localdomain ([78.37.166.219]) (authenticated user i.bornyakov@metrotek.ru) by mail.pr-group.ru with ESMTPSA (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)); Mon, 6 Mar 2023 09:05:26 +0300 From: Ivan Bornyakov <i.bornyakov@metrotek.ru> To: linux-imx@nxp.com Cc: Ivan Bornyakov <i.bornyakov@metrotek.ru>, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH RESEND] bus: imx-weim: fix branch condition evaluates to a garbage value Date: Mon, 6 Mar 2023 09:05:05 +0300 Message-Id: <20230306060505.11657-1-i.bornyakov@metrotek.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759599201079538640?= X-GMAIL-MSGID: =?utf-8?q?1759599201079538640?= |
Series |
[RESEND] bus: imx-weim: fix branch condition evaluates to a garbage value
|
|
Commit Message
Ivan Bornyakov
March 6, 2023, 6:05 a.m. UTC
If bus type is other than imx50_weim_devtype and have no child devices,
variable 'ret' in function weim_parse_dt() will not be initialized, but
will be used as branch condition and return value. Fix this by
initializing 'ret' with 0.
This was discovered with help of clang-analyzer, but the situation is
quite possible in real life.
Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Cc: stable@vger.kernel.org
---
drivers/bus/imx-weim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Mar 6, 2023 at 3:05 AM Ivan Bornyakov <i.bornyakov@metrotek.ru> wrote: > > If bus type is other than imx50_weim_devtype and have no child devices, > variable 'ret' in function weim_parse_dt() will not be initialized, but > will be used as branch condition and return value. Fix this by > initializing 'ret' with 0. > > This was discovered with help of clang-analyzer, but the situation is > quite possible in real life. > > Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> > Cc: stable@vger.kernel.org Please add a Fixes tag here. Reviewed-by: Fabio Estevam <festevam@gmail.com>
On Mon, Mar 06, 2023 at 09:05:05AM +0300, Ivan Bornyakov wrote: > If bus type is other than imx50_weim_devtype and have no child devices, > variable 'ret' in function weim_parse_dt() will not be initialized, but > will be used as branch condition and return value. Fix this by > initializing 'ret' with 0. > > This was discovered with help of clang-analyzer, but the situation is > quite possible in real life. > > Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> > Cc: stable@vger.kernel.org Fixes: 52c47b63412b ("bus: imx-weim: improve error handling upon child probe-failure") Is it OK, or should I post v2 with "Fixes:" tag? > --- > drivers/bus/imx-weim.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c > index 828c66bbaa67..55d917bd1f3f 100644 > --- a/drivers/bus/imx-weim.c > +++ b/drivers/bus/imx-weim.c > @@ -204,8 +204,8 @@ static int weim_parse_dt(struct platform_device *pdev) > const struct of_device_id *of_id = of_match_device(weim_id_table, > &pdev->dev); > const struct imx_weim_devtype *devtype = of_id->data; > + int ret = 0, have_child = 0; > struct device_node *child; > - int ret, have_child = 0; > struct weim_priv *priv; > void __iomem *base; > u32 reg; > -- > 2.39.2 >
On Mon, Mar 6, 2023 at 10:10 AM Ivan Bornyakov <i.bornyakov@metrotek.ru> wrote: > Fixes: 52c47b63412b ("bus: imx-weim: improve error handling upon child probe-failure") > > Is it OK, or should I post v2 with "Fixes:" tag? Please post a v2 with the Fixes tag and my Reviewed-by tag, thanks.
diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 828c66bbaa67..55d917bd1f3f 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -204,8 +204,8 @@ static int weim_parse_dt(struct platform_device *pdev) const struct of_device_id *of_id = of_match_device(weim_id_table, &pdev->dev); const struct imx_weim_devtype *devtype = of_id->data; + int ret = 0, have_child = 0; struct device_node *child; - int ret, have_child = 0; struct weim_priv *priv; void __iomem *base; u32 reg;