* [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static()
@ 2018-02-01 10:25 Geert Uytterhoeven
2018-02-01 11:28 ` Nikolay Aleksandrov
2018-02-01 14:48 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-02-01 10:25 UTC (permalink / raw)
To: Nikolay Aleksandrov, David S . Miller, Stephen Hemminger
Cc: Arnd Bergmann, bridge, netdev, linux-kernel, Geert Uytterhoeven
With gcc-4.1.2.:
net/bridge/br_fdb.c: In function ‘br_fdb_sync_static’:
net/bridge/br_fdb.c:996: warning: ‘err’ may be used uninitialized in this function
Indeed, if the list is empty, err will be uninitialized, and will be
propagated up as the function return value.
Fix this by preinitializing err to zero.
Fixes: eb7935830d00b9e0 ("net: bridge: use rhashtable for fdbs")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
net/bridge/br_fdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index dc87fbc9a23b04e6..d9e69e4514beb20d 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -993,7 +993,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p)
{
struct net_bridge_fdb_entry *f, *tmp;
- int err;
+ int err = 0;
ASSERT_RTNL();
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static()
2018-02-01 10:25 [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static() Geert Uytterhoeven
@ 2018-02-01 11:28 ` Nikolay Aleksandrov
2018-02-01 14:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2018-02-01 11:28 UTC (permalink / raw)
To: Geert Uytterhoeven, David S . Miller, Stephen Hemminger
Cc: Arnd Bergmann, bridge, netdev, linux-kernel
On 01/02/18 12:25, Geert Uytterhoeven wrote:
> With gcc-4.1.2.:
>
> net/bridge/br_fdb.c: In function ‘br_fdb_sync_static’:
> net/bridge/br_fdb.c:996: warning: ‘err’ may be used uninitialized in this function
>
> Indeed, if the list is empty, err will be uninitialized, and will be
> propagated up as the function return value.
>
> Fix this by preinitializing err to zero.
>
> Fixes: eb7935830d00b9e0 ("net: bridge: use rhashtable for fdbs")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> net/bridge/br_fdb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index dc87fbc9a23b04e6..d9e69e4514beb20d 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -993,7 +993,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
> int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p)
> {
> struct net_bridge_fdb_entry *f, *tmp;
> - int err;
> + int err = 0;
>
> ASSERT_RTNL();
>
>
Thanks,
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static()
2018-02-01 10:25 [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static() Geert Uytterhoeven
2018-02-01 11:28 ` Nikolay Aleksandrov
@ 2018-02-01 14:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-02-01 14:48 UTC (permalink / raw)
To: geert; +Cc: nikolay, stephen, arnd, bridge, netdev, linux-kernel
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Thu, 1 Feb 2018 11:25:27 +0100
> With gcc-4.1.2.:
>
> net/bridge/br_fdb.c: In function ‘br_fdb_sync_static’:
> net/bridge/br_fdb.c:996: warning: ‘err’ may be used uninitialized in this function
>
> Indeed, if the list is empty, err will be uninitialized, and will be
> propagated up as the function return value.
>
> Fix this by preinitializing err to zero.
>
> Fixes: eb7935830d00b9e0 ("net: bridge: use rhashtable for fdbs")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Applied, thanks Geert.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-01 14:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-01 10:25 [PATCH] net: bridge: Fix uninitialized error in br_fdb_sync_static() Geert Uytterhoeven
2018-02-01 11:28 ` Nikolay Aleksandrov
2018-02-01 14:48 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).