From: Dan Carpenter <error27@gmail.com>
To: Longxuan Yu <ylong030@ucr.edu>
Cc: Simon Horman <horms@kernel.org>, netdev@vger.kernel.org
Subject: [bug report] 8021q: delete cleared egress QoS mappings
Date: Fri, 24 Apr 2026 08:17:39 +0300 [thread overview]
Message-ID: <aer889IeBHjL8na0@stanley.mountain> (raw)
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
reply other threads:[~2026-04-24 5:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aer889IeBHjL8na0@stanley.mountain \
--to=error27@gmail.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ylong030@ucr.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox