From: Simon Horman <simon.horman@corigine.com>
To: Justin Chen <justin.chen@broadcom.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
bcm-kernel-feedback-list@broadcom.com,
florian.fainelli@broadcom.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, opendmb@gmail.com, andrew@lunn.ch,
hkallweit1@gmail.com, linux@armlinux.org.uk,
richardcochran@gmail.com, sumit.semwal@linaro.org,
christian.koenig@amd.com
Subject: Re: [PATCH net-next v7 08/11] net: bcmasp: Add support for ethtool driver stats
Date: Thu, 15 Jun 2023 10:07:26 +0200 [thread overview]
Message-ID: <ZIrGvsesltAc+izQ@corigine.com> (raw)
In-Reply-To: <1686781820-832-9-git-send-email-justin.chen@broadcom.com>
On Wed, Jun 14, 2023 at 03:30:17PM -0700, Justin Chen wrote:
...
> +static void bcmasp_update_mib_counters(struct bcmasp_intf *intf)
> +{
> + int i;
> +
> + for (i = 0; i < BCMASP_STATS_LEN; i++) {
> + const struct bcmasp_stats *s;
> + u32 offset, val;
> + char *p;
> +
> + s = &bcmasp_gstrings_stats[i];
> + offset = bcmasp_stat_fixup_offset(intf, s);
> + switch (s->type) {
> + case BCMASP_STAT_SOFT:
> + continue;
> + case BCMASP_STAT_RX_EDPKT:
> + val = rx_edpkt_core_rl(intf->parent, offset);
> + break;
> + case BCMASP_STAT_RX_CTRL:
> + val = rx_ctrl_core_rl(intf->parent, offset);
> + break;
> + case BCMASP_STAT_RX_CTRL_PER_INTF:
> + offset += sizeof(u32) * intf->port;
> + val = rx_ctrl_core_rl(intf->parent, offset);
> + break;
> + }
> + p = (char *)(&intf->mib) + (i * sizeof(u32));
> + put_unaligned(val, (u32 *)p);
Hi Justin,
GCC 12.2.0, in a W=1 build, warns that val may be used uninitialised here.
I think that, in theory, that can occur if s->type doesn't match
any of the case statements above. Perhaps in practice that cannot occur.
But, perhaps it would be worth adding a default case with some suitable
handling.
In file included from drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c:4:
./include/asm-generic/unaligned.h: In function 'bcmasp_get_ethtool_stats':
./include/asm-generic/unaligned.h:19:19: warning: 'val' may be used uninitialized [-Wmaybe-uninitialized]
19 | __pptr->x = (val); \
| ^
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c:125:29: note: 'val' was declared here
125 | u32 offset, val;
|
> + }
> +}
...
next prev parent reply other threads:[~2023-06-15 8:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 22:30 [PATCH net-next v7 00/11] Brcm ASP 2.0 Ethernet Controller Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 01/11] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0 Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 02/11] dt-bindings: net: Brcm ASP 2.0 Ethernet controller Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 03/11] net: bcmasp: Add support for ASP2.0 " Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 04/11] net: bcmasp: Add support for WoL magic packet Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 05/11] net: bcmasp: Add support for wake on net filters Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 06/11] net: bcmasp: Add support for eee mode Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 07/11] net: bcmasp: Add support for ethtool standard stats Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 08/11] net: bcmasp: Add support for ethtool driver stats Justin Chen
2023-06-15 8:07 ` Simon Horman [this message]
2023-06-14 22:30 ` [PATCH net-next v7 09/11] net: phy: mdio-bcm-unimac: Add asp v2.0 support Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 10/11] net: phy: bcm7xxx: Add EPHY entry for 74165 Justin Chen
2023-06-14 22:30 ` [PATCH net-next v7 11/11] MAINTAINERS: ASP 2.0 Ethernet driver maintainers Justin Chen
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=ZIrGvsesltAc+izQ@corigine.com \
--to=simon.horman@corigine.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=justin.chen@broadcom.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sumit.semwal@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).