From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: net: ethernet: starfire: while loop that is never executed
Date: Tue, 29 Oct 2024 22:02:41 +0000 [thread overview]
Message-ID: <cf40ac34-1655-4eee-85dc-c836e77eb301@gmail.com> (raw)
Hi,
There is a while-loop in function set_vlan_mode in source
drivers/net/ethernet/adaptec/starfire.c that currently never gets
executed, the code is as follows:
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;
the while (vlan_count < 32) loop will never get executed because the
outer if statement is only executed if val_count is equal to 32 hence
val_count < 32 will be false. I'm assuming the while loop is filing the
unused slots with zero, so I suspect the code should be:
if (vlan_count == 32)
ret |= PerfectFilterVlan;
while (vlan_count < 32) {
writew(0, filter_addr);
filter_addr += 16;
vlan_count++;
}
..however I can't find any info on this H/W and I can't test it, so I'm
not confident my assumption here is correct.
Colin
reply other threads:[~2024-10-29 22:02 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=cf40ac34-1655-4eee-85dc-c836e77eb301@gmail.com \
--to=colin.i.king@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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