public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] 8021q: delete cleared egress QoS mappings
@ 2026-04-24  5:17 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-04-24  5:17 UTC (permalink / raw)
  To: Longxuan Yu; +Cc: Simon Horman, netdev

Hello Longxuan Yu,

Commit 7dddc74af369 ("8021q: delete cleared egress QoS mappings")
from Apr 20, 2026 (linux-next), leads to the following Smatch static
checker warning:

	net/8021q/vlan_dev.c:211 vlan_dev_set_egress_priority()
	warn: duplicate zero check 'vlan_qos' (previous on line 200)

net/8021q/vlan_dev.c
    171 int vlan_dev_set_egress_priority(const struct net_device *dev,
    172                                  u32 skb_prio, u16 vlan_prio)
    173 {
    174         struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
    175         struct vlan_priority_tci_mapping __rcu **mpp;
    176         struct vlan_priority_tci_mapping *mp;
    177         struct vlan_priority_tci_mapping *np;
    178         u32 bucket = skb_prio & 0xF;
    179         u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK;
    180 
    181         /* See if a priority mapping exists.. */
    182         mpp = &vlan->egress_priority_map[bucket];
    183         mp = rtnl_dereference(*mpp);
    184         while (mp) {
    185                 if (mp->priority == skb_prio) {
    186                         if (!vlan_qos) {
    187                                 rcu_assign_pointer(*mpp, rtnl_dereference(mp->next));
    188                                 vlan->nr_egress_mappings--;
    189                                 kfree_rcu(mp, rcu);
    190                         } else {
    191                                 WRITE_ONCE(mp->vlan_qos, vlan_qos);
    192                         }
    193                         return 0;
    194                 }
    195                 mpp = &mp->next;
    196                 mp = rtnl_dereference(*mpp);
    197         }
    198 
    199         /* Create a new mapping then. */
    200         if (!vlan_qos)
                ^^^^^^^^^^^^^^
The commit adds this check

    201                 return 0;
    202 
    203         np = kmalloc_obj(struct vlan_priority_tci_mapping);
    204         if (!np)
    205                 return -ENOBUFS;
    206 
    207         np->priority = skb_prio;
    208         np->vlan_qos = vlan_qos;
    209         RCU_INIT_POINTER(np->next, rtnl_dereference(vlan->egress_priority_map[bucket]));
    210         rcu_assign_pointer(vlan->egress_priority_map[bucket], np);
--> 211         if (vlan_qos)
                ^^^^^^^^^^^^^
So now this old one could be deleted.

    212                 vlan->nr_egress_mappings++;
    213         return 0;
    214 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-24  5:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24  5:17 [bug report] 8021q: delete cleared egress QoS mappings Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox