lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c2fccf4-8754-429c-9d51-903889714b3d@lunn.ch>
Date: Tue, 18 Feb 2025 14:53:39 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: Breno Leitao <leitao@...ian.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Mateusz Polchlopek <mateusz.polchlopek@...el.com>
Subject: Re: [PATCH net-next v2] net: Remove redundant variable declaration
 in __dev_change_flags()

On Tue, Feb 18, 2025 at 09:35:55AM +0100, Nicolas Dichtel wrote:
> Le 17/02/2025 à 16:48, Breno Leitao a écrit :
> > The old_flags variable is declared twice in __dev_change_flags(),
> > causing a shadow variable warning. This patch fixes the issue by
> > removing the redundant declaration, reusing the existing old_flags
> > variable instead.
> > 
> > 	net/core/dev.c:9225:16: warning: declaration shadows a local variable [-Wshadow]
> > 	9225 |                 unsigned int old_flags = dev->flags;
> > 	|                              ^
> > 	net/core/dev.c:9185:15: note: previous declaration is here
> > 	9185 |         unsigned int old_flags = dev->flags;
> > 	|                      ^
> > 	1 warning generated.
> > 
> > Remove the redundant inner declaration and reuse the existing old_flags
> > variable since its value is not needed outside the if block, and it is
> > safe to reuse the variable. This eliminates the warning while
> > maintaining the same functionality.
> > 
> > Signed-off-by: Breno Leitao <leitao@...ian.org>
> > Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>

Reviewed-by: Andrew Lunn <andrew@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ