* starfire: set_vlan_mode contains dead code in a while loop
@ 2026-03-10 15:04 Colin King (gmail)
0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2026-03-10 15:04 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev@vger.kernel.org, Jiri Pirko
Cc: linux-kernel@vger.kernel.org
[-- Attachment #1.1.1: Type: text/plain, Size: 1263 bytes --]
Hi,
There is an issue in function set_vlan_mode with code that is never
executed in the following commit:
commit 5da96be53a16a62488316810d0c7c5d58ce3ee4f
Author: Jiri Pirko <jiri@resnulli.us>
Date: Wed Jul 20 04:54:31 2011 +0000
starfire: do vlan cleanup
The issue is as follows:
static u32 set_vlan_mode(struct netdev_private *np)
{
u32 ret = VlanMode;
u16 vid;
void __iomem *filter_addr = np->base + HashTable + 8;
int vlan_count = 0;
for_each_set_bit(vid, np->active_vlans, VLAN_N_VID) {
if (vlan_count == 32)
break;
writew(vid, filter_addr);
filter_addr += 16;
vlan_count++;
}
if (vlan_count == 32) {
ret |= PerfectFilterVlan;
while (vlan_count < 32) {
writew(0, filter_addr);
filter_addr += 16;
vlan_count++;
}
}
return ret;
}
If vlan_count is 32 then the while loop is currently dead code since
vlan_count cannot be less than 32 (so the loop is never executed).
This logic seems broken.
Colin
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-10 15:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 15:04 starfire: set_vlan_mode contains dead code in a while loop Colin King (gmail)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox