* [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-10 15:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-02-10 15:09 UTC (permalink / raw)
To: Stephen Hemminger, David S. Miller
Cc: linux-arm-kernel, Arnd Bergmann, Elad Raz, Jiri Pirko, bridge,
netdev, linux-kernel
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")
---
net/bridge/br_mdb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index ac089286526e..9ab1fcd488c6 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -437,8 +437,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;
}
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-10 15:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-02-10 15:09 UTC (permalink / raw)
To: Stephen Hemminger, David S. Miller
Cc: Arnd Bergmann, netdev, bridge, linux-kernel, Jiri Pirko,
Elad Raz, linux-arm-kernel
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")
---
net/bridge/br_mdb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index ac089286526e..9ab1fcd488c6 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -437,8 +437,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;
}
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-10 15:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-02-10 15:09 UTC (permalink / raw)
To: linux-arm-kernel
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")
---
net/bridge/br_mdb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index ac089286526e..9ab1fcd488c6 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -437,8 +437,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;
}
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Bridge] [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-10 15:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-02-10 15:09 UTC (permalink / raw)
To: Stephen Hemminger, David S. Miller
Cc: Arnd Bergmann, netdev, bridge, linux-kernel, Jiri Pirko,
Elad Raz, linux-arm-kernel
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")
---
net/bridge/br_mdb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index ac089286526e..9ab1fcd488c6 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -437,8 +437,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;
}
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] bridge: mdb: avoid uninitialized variable warning
2016-02-10 15:09 ` Arnd Bergmann
(?)
(?)
@ 2016-02-16 20:37 ` David Miller
-1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-02-16 20:37 UTC (permalink / raw)
To: arnd; +Cc: stephen, linux-arm-kernel, eladr, jiri, bridge, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 10 Feb 2016 16:09:02 +0100
> 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")
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-16 20:37 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-02-16 20:37 UTC (permalink / raw)
To: arnd; +Cc: netdev, bridge, linux-kernel, jiri, eladr, linux-arm-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 10 Feb 2016 16:09:02 +0100
> 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")
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-16 20:37 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-02-16 20:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 10 Feb 2016 16:09:02 +0100
> 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")
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bridge] [PATCH] bridge: mdb: avoid uninitialized variable warning
@ 2016-02-16 20:37 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2016-02-16 20:37 UTC (permalink / raw)
To: arnd; +Cc: netdev, bridge, linux-kernel, jiri, eladr, linux-arm-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 10 Feb 2016 16:09:02 +0100
> 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")
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-16 20:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10 15:09 [PATCH] bridge: mdb: avoid uninitialized variable warning Arnd Bergmann
2016-02-10 15:09 ` [Bridge] " Arnd Bergmann
2016-02-10 15:09 ` Arnd Bergmann
2016-02-10 15:09 ` Arnd Bergmann
2016-02-16 20:37 ` David Miller
2016-02-16 20:37 ` [Bridge] " David Miller
2016-02-16 20:37 ` David Miller
2016-02-16 20:37 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.