From: Paolo Abeni <pabeni@redhat.com>
To: Shenwei Wang <shenwei.wang@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH v2 RESEND 1/1] net: fec: add xdp and page pool statistics
Date: Thu, 10 Nov 2022 12:54:13 +0100 [thread overview]
Message-ID: <4349bc93a5f2130a95305287141fde369245f921.camel@redhat.com> (raw)
In-Reply-To: <20221109023147.242904-1-shenwei.wang@nxp.com>
Hello,
On Tue, 2022-11-08 at 20:31 -0600, Shenwei Wang wrote:
> @@ -2685,9 +2738,16 @@ static void fec_enet_get_strings(struct net_device *netdev,
> int i;
> switch (stringset) {
> case ETH_SS_STATS:
> - for (i = 0; i < ARRAY_SIZE(fec_stats); i++)
> - memcpy(data + i * ETH_GSTRING_LEN,
> - fec_stats[i].name, ETH_GSTRING_LEN);
> + for (i = 0; i < ARRAY_SIZE(fec_stats); i++) {
> + memcpy(data, fec_stats[i].name, ETH_GSTRING_LEN);
> + data += ETH_GSTRING_LEN;
> + }
> + for (i = 0; i < ARRAY_SIZE(fec_xdp_stat_strs); i++) {
> + memcpy(data, fec_xdp_stat_strs[i], ETH_GSTRING_LEN);
> + data += ETH_GSTRING_LEN;
The above triggers a warning:
In function ‘fortify_memcpy_chk’,
inlined from ‘fec_enet_get_strings’ at ../drivers/net/ethernet/freescale/fec_main.c:2788:4:
../include/linux/fortify-string.h:413:25: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
413 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I think you can address it changing fec_xdp_stat_strs definition to:
static const char fec_xdp_stat_strs[XDP_STATS_TOTAL][ETH_GSTRING_LEN] = { // ...
Cheers,
Paolo
next prev parent reply other threads:[~2022-11-10 11:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 2:31 [PATCH v2 RESEND 1/1] net: fec: add xdp and page pool statistics Shenwei Wang
2022-11-10 11:54 ` Paolo Abeni [this message]
2022-11-10 13:29 ` [EXT] " Shenwei Wang
2022-11-10 16:43 ` Alexander Lobakin
2022-11-10 21:40 ` [EXT] " Shenwei Wang
2022-11-14 13:35 ` Alexander Lobakin
2022-11-14 13:50 ` Andrew Lunn
2022-11-14 13:57 ` Alexander Lobakin
2022-11-14 15:01 ` [EXT] " Shenwei Wang
2022-11-14 16:27 ` Andrew Lunn
2022-11-14 16:31 ` Shenwei Wang
2022-11-10 23:32 ` kernel test robot
2022-11-11 5:46 ` kernel test robot
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=4349bc93a5f2130a95305287141fde369245f921.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=imx@lists.linux.dev \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shenwei.wang@nxp.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;
as well as URLs for NNTP newsgroup(s).