Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp383554ima; Wed, 6 Feb 2019 01:31:28 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibx5VFHvQf49FooXMqQ8CoApHfzRkMDwuTVrGD+xdn++gRRQ8zLUCdhaiXx+aD3HZ0w6I8w X-Received: by 2002:a63:902:: with SMTP id 2mr8248277pgj.219.1549445488149; Wed, 06 Feb 2019 01:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549445488; cv=none; d=google.com; s=arc-20160816; b=p+Wu0HkRPcTpI5A0Q6G/4FEYvwbL8u5NkcBJryRVUfZRi8mXRX3KvfqxcQvu4j2nKJ b3j3cOh4PEjT/tzqTFTgHmNDX8ZOAFq/a0Ba2fm3QHxYLw0uOk62ciiqz4M3adqNjCMN 9hHH69UhKbzkZKWnEc/p9ZdkTW6ixc/wrBx9CT0Ibjwuokc0mxDr4HKO4LZM8LZArTcz Bx3T+g+10TXCKUSAvu//7JKQZtrbHROUMSPO8300smoT2RczHMgo240N0lWDVafjU411 4NYmUqV+jRVa/00IL9bOPv7iVHnq5deEy2vYQyu0EjCw1Kh3/JIl71ws2kRA51S01wIr nIMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BgA4cM6CmZOKu3KONTtRnbhiViOLq/Vay+uo7WssCXw=; b=zOaLjbhTO41W/2bcS4uXRVxmt9GUDmiXRkC1F7wXiM5rnfjvxaY0iaLUjZp16cZ4Xl eir1OyuNix6iyu3MgDUJGT7QcElF8nBWqflJy+XRKLPtHG8s+RKYd67RfkI5UzXldBLo 1uEhlgayOgwNQuv9Wfx1ifnyFmXimKaPS5EAfxFivZMXUA+wJ86QSYZRf/wFug0kW3m+ nUzVgoS/3f2U/GmRp8BBy40c9/ExvAZk2yAxuBaxnrBPrKpdlMWR1XT8i3SV8PAjN2l6 Z2fX0IHIcVI9iW0NuOxriFwlEgt5E8bmW9TTdODYaOZffaXKi4R9u7r/y6XsTde6WVNL D9Ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si2195692pgf.54.2019.02.06.01.31.11; Wed, 06 Feb 2019 01:31:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728251AbfBFJSu (ORCPT + 99 others); Wed, 6 Feb 2019 04:18:50 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:50023 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfBFJSt (ORCPT ); Wed, 6 Feb 2019 04:18:49 -0500 X-Originating-IP: 90.88.22.177 Received: from localhost (aaubervilliers-681-1-80-177.w90-88.abo.wanadoo.fr [90.88.22.177]) (Authenticated sender: maxime.ripard@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 459F26001C; Wed, 6 Feb 2019 09:18:44 +0000 (UTC) Date: Wed, 6 Feb 2019 10:18:44 +0100 From: Maxime Ripard To: Yizhuo Cc: csong@cs.ucr.edu, zhiyunq@cs.ucr.edu, Giuseppe Cavallaro , Alexandre Torgue , Chen-Yu Tsai , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: stmmac: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized Message-ID: <20190206091844.gqwomr4j2pe3vvvn@flea> References: <20190205221559.17545-1-yzhai003@ucr.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5fngwngoxyun3lzg" Content-Disposition: inline In-Reply-To: <20190205221559.17545-1-yzhai003@ucr.edu> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5fngwngoxyun3lzg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Feb 05, 2019 at 02:15:59PM -0800, Yizhuo wrote: > In function sun8i_dwmac_set_syscon(), local variable "val" could > be uninitialized if function regmap_read() returns -EINVAL. > However, it will be used directly in the if statement, which > is potentially unsafe. >=20 > Signed-off-by: Yizhuo > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-sun8i.c > index 39c2122a4f26..11d481c9e7ab 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > @@ -639,9 +639,14 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv= *priv) > struct sunxi_priv_data *gmac =3D priv->plat->bsp_priv; > struct device_node *node =3D priv->device->of_node; > int ret; > - u32 reg, val; > + u32 reg, val =3D 0; I guess we don't need to initialize it anymore with the check you add? Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --5fngwngoxyun3lzg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXFqmdAAKCRDj7w1vZxhR xbdEAQDkVLWjPxsG2BD//iU7Y0A7XKf0pM9pJSkJi3keBVJE8QEAqcUZmZksPBsL N2GJOL9haNEujvY7y0VzsuCthVc1hwY= =QjTU -----END PGP SIGNATURE----- --5fngwngoxyun3lzg--