[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4349bc93a5f2130a95305287141fde369245f921.camel@redhat.com>
Date: Thu, 10 Nov 2022 12:54:13 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Shenwei Wang <shenwei.wang@....com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev
Subject: Re: [PATCH v2 RESEND 1/1] net: fec: add xdp and page pool statistics
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
Powered by blists - more mailing lists