* [PATCH net] net: dsa: silence a static checker warning
@ 2019-11-26 12:18 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-11-26 12:18 UTC (permalink / raw)
To: Andrew Lunn, Vladimir Oltean
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
kernel-janitors
This code is harmless but it triggers a Smatch static checker warning:
net/dsa/tag_8021q.c:108 dsa_8021q_restore_pvid()
error: uninitialized symbol 'pvid'.
I believe that UBSan will complain at run time as well. The solution is
to just re-order the conditions.
Fixes: c80ed84e7688 ("net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/dsa/tag_8021q.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 9e5a883a9f0c..4dd1dc27bc98 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -106,7 +106,7 @@ static int dsa_8021q_restore_pvid(struct dsa_switch *ds, int port)
slave = ds->ports[port].slave;
err = br_vlan_get_pvid(slave, &pvid);
- if (!pvid || err < 0)
+ if (err < 0 || !pvid)
/* There is no pvid on the bridge for this port, which is
* perfectly valid. Nothing to restore, bye-bye!
*/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net] net: dsa: silence a static checker warning
@ 2019-11-26 12:18 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-11-26 12:18 UTC (permalink / raw)
To: Andrew Lunn, Vladimir Oltean
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
kernel-janitors
This code is harmless but it triggers a Smatch static checker warning:
net/dsa/tag_8021q.c:108 dsa_8021q_restore_pvid()
error: uninitialized symbol 'pvid'.
I believe that UBSan will complain at run time as well. The solution is
to just re-order the conditions.
Fixes: c80ed84e7688 ("net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/dsa/tag_8021q.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 9e5a883a9f0c..4dd1dc27bc98 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -106,7 +106,7 @@ static int dsa_8021q_restore_pvid(struct dsa_switch *ds, int port)
slave = ds->ports[port].slave;
err = br_vlan_get_pvid(slave, &pvid);
- if (!pvid || err < 0)
+ if (err < 0 || !pvid)
/* There is no pvid on the bridge for this port, which is
* perfectly valid. Nothing to restore, bye-bye!
*/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: silence a static checker warning
2019-11-26 12:18 ` Dan Carpenter
@ 2019-11-26 23:17 ` David Miller
-1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-11-26 23:17 UTC (permalink / raw)
To: dan.carpenter
Cc: andrew, olteanv, vivien.didelot, f.fainelli, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 26 Nov 2019 15:18:54 +0300
> This code is harmless but it triggers a Smatch static checker warning:
>
> net/dsa/tag_8021q.c:108 dsa_8021q_restore_pvid()
> error: uninitialized symbol 'pvid'.
>
> I believe that UBSan will complain at run time as well. The solution is
> to just re-order the conditions.
>
> Fixes: c80ed84e7688 ("net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
THis doesn't apply to the current net tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: silence a static checker warning
@ 2019-11-26 23:17 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-11-26 23:17 UTC (permalink / raw)
To: dan.carpenter
Cc: andrew, olteanv, vivien.didelot, f.fainelli, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 26 Nov 2019 15:18:54 +0300
> This code is harmless but it triggers a Smatch static checker warning:
>
> net/dsa/tag_8021q.c:108 dsa_8021q_restore_pvid()
> error: uninitialized symbol 'pvid'.
>
> I believe that UBSan will complain at run time as well. The solution is
> to just re-order the conditions.
>
> Fixes: c80ed84e7688 ("net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
THis doesn't apply to the current net tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-26 23:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 12:18 [PATCH net] net: dsa: silence a static checker warning Dan Carpenter
2019-11-26 12:18 ` Dan Carpenter
2019-11-26 23:17 ` David Miller
2019-11-26 23:17 ` 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.