From: Simon Horman <horms@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: florian.fainelli@broadcom.com, netdev@vger.kernel.org,
opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, zakkemble@gmail.com,
ryotkkr98@gmail.com, linux-kernel@vger.kernel.org,
nb@tipi-net.de
Subject: Re: [PATCH net 1/6] net: bcmasp: fix mib counters struct alignment with ethtool stats
Date: Mon, 28 Sep 2026 14:31:31 +0100 [thread overview]
Message-ID: <20260928133131.GR13925@horms.kernel.org> (raw)
In-Reply-To: <179027136810.2160803.5519251364954584171@kernel.org>
On Thu, Sep 24, 2026 at 05:36:08PM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The commit message overstates what the bug did.
>
> --
>
> net: bcmasp: fix mib counters struct alignment with ethtool stats
>
> This commit removes the leftover edpkt_* fields from the start of struct
> bcmasp_mib_counters. They were left in place when the matching
> bcmasp_gstrings_stats[] entries were removed for asp-v3.0. Since then the
> struct layout has not matched the order the ethtool code indexes by.
>
> > Because bcmasp_update_mib_counters() and bcmasp_get_ethtool_stats() index
> > into struct bcmasp_mib_counters sequentially based on the order of
> > bcmasp_gstrings_stats, this 16-byte offset caused hardware statistics
> > to be written to the wrong struct members and software counters to be
> > read from incorrect offsets (and reading out-of-bounds at the end of the
> > struct).
>
> [Severity: Medium]
> Is the out-of-bounds part of this description accurate?
>
> Before this patch, struct bcmasp_mib_counters had 17 u32 members (68
> bytes), and bcmasp_gstrings_stats[] has 13 entries. Both loops stop at
> BCMASP_STATS_LEN:
>
> drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c:bcmasp_get_ethtool_stats() {
> ...
> for (i = 0; i < BCMASP_STATS_LEN; i++) {
> p = (char *)(&intf->mib) + (i * sizeof(u32));
> data[i] = *(u32 *)p;
> }
> }
>
> So the highest offset either loop touches is 12 * 4 = 48 bytes, which is
> inside the 68-byte struct.
>
> The hardware values also appear to have reached userspace correctly.
> bcmasp_update_mib_counters() writes them to raw slots 0-4, and
> bcmasp_get_ethtool_stats() reads them back from the same slots. The only
> members overwritten were edpkt_* and umac_frm_cnt, and no code uses those
> by name.
>
> The part that looks broken is the software counters. Code increments them
> by name (intf->mib.alloc_rx_skb_failed++, tx_dma_failed++, and so on).
> They sit in raw slots 9-16, but ethtool read slots 5-12. As a result:
>
> - "RX SKB Alloc Failed", "TX DMA Failed", "Multicast Filters Full" and
> "Unicast Filters Full" read fb_* members that are never written, so
> they always showed 0.
>
> - The next four strings showed the values of the first four software
> counters.
>
> - filters_combine_cnt, promisc_filters_cnt, tx_realloc_offload_failed
> and tx_timeout_cnt were never shown at all.
>
> Could the commit message describe this as shifted or mislabeled software
> counters, rather than as an out-of-bounds read at the end of the struct?
I've looked over the above. And while perhaps this alone doesn't warrant
a re-spin. The analysis does seem to be correct to me.
next prev parent reply other threads:[~2026-09-28 13:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 22:16 [PATCH net 0/6] net: bcmasp: Collection of fixes Florian Fainelli
2026-09-22 22:16 ` [PATCH net 1/6] net: bcmasp: fix mib counters struct alignment with ethtool stats Florian Fainelli
2026-09-24 17:36 ` netdev-bot+sashiko
2026-09-28 13:31 ` Simon Horman [this message]
2026-09-22 22:16 ` [PATCH net 2/6] net: bcmasp: unmap previous DMA mappings on TX map failure Florian Fainelli
2026-09-25 11:10 ` Nicolai Buchwitz
2026-09-22 22:16 ` [PATCH net 3/6] net: bcmasp: validate minimum RX packet size in bcmasp_rx_poll() Florian Fainelli
2026-09-24 17:36 ` netdev-bot+sashiko
2026-09-28 13:36 ` Simon Horman
2026-09-22 22:16 ` [PATCH net 4/6] net: bcmasp: fix OF node reference leak for phy_dn Florian Fainelli
2026-09-25 11:11 ` Nicolai Buchwitz
2026-09-22 22:16 ` [PATCH net 5/6] net: bcmasp: account for offload header in TX short packet padding Florian Fainelli
2026-09-24 17:36 ` netdev-bot+sashiko
2026-09-22 22:16 ` [PATCH net 6/6] net: bcmasp: fix network filter lookup and wake filter pair allocation Florian Fainelli
2026-09-24 17:36 ` netdev-bot+sashiko
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=20260928133131.GR13925@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=ryotkkr98@gmail.com \
--cc=zakkemble@gmail.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
all inboxes | Powered by JetHome®