diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-02-10 16:09:02 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-16 15:37:28 -0500 |
commit | 56bb7fd994f4cc163de08006bf68d959027a9f36 (patch) | |
tree | 8f6591932bb158fc845e119a0560b8827eff2e8d /net/bridge | |
parent | b5e4d0bcf77e56362252a7ced4dbb476425e1655 (diff) | |
download | talos-obmc-linux-56bb7fd994f4cc163de08006bf68d959027a9f36.tar.gz talos-obmc-linux-56bb7fd994f4cc163de08006bf68d959027a9f36.zip |
bridge: mdb: avoid uninitialized variable warning
A recent change to the mdb code confused the compiler to the point
where it did not realize that the port-group returned from
br_mdb_add_group() is always valid when the function returns a nonzero
return value, so we get a spurious warning:
net/bridge/br_mdb.c: In function 'br_mdb_add':
net/bridge/br_mdb.c:542:4: error: 'pg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
__br_mdb_notify(dev, entry, RTM_NEWMDB, pg);
Slightly rearranging the code in br_mdb_add_group() makes the problem
go away, as gcc is clever enough to see that both functions check
for 'ret != 0'.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9e8430f8d60d ("bridge: mdb: Passing the port-group pointer to br_mdb module")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_mdb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 30e105f57f0d..74c278e00225 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -425,8 +425,8 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, mp = br_mdb_ip_get(mdb, group); if (!mp) { mp = br_multicast_new_group(br, port, group); - err = PTR_ERR(mp); - if (IS_ERR(mp)) + err = PTR_ERR_OR_ZERO(mp); + if (err) return err; } |