[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230821070331.GA2711035@kernel.org>
Date: Mon, 21 Aug 2023 09:03:31 +0200
From: Simon Horman <horms@...nel.org>
To: "GONG, Ruiqi" <gongruiqi@...weicloud.com>
Cc: Chris Snook <chris.snook@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Sabrina Dubroca <sd@...asysnail.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
gongruiqi1@...wei.com
Subject: Re: [PATCH RESEND net-next] alx: fix OOB-read compiler warning
On Mon, Aug 21, 2023 at 09:32:18AM +0800, GONG, Ruiqi wrote:
> From: "GONG, Ruiqi" <gongruiqi1@...wei.com>
>
> The following message shows up when compiling with W=1:
>
> In function ‘fortify_memcpy_chk’,
> inlined from ‘alx_get_ethtool_stats’ at drivers/net/ethernet/atheros/alx/ethtool.c:297:2:
> ./include/linux/fortify-string.h:592:4: error: call to ‘__read_overflow2_field’
> declared with attribute warning: detected read beyond size of field (2nd parameter);
> maybe use struct_group()? [-Werror=attribute-warning]
> 592 | __read_overflow2_field(q_size_field, size);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> In order to get alx stats altogether, alx_get_ethtool_stats() reads
> beyond hw->stats.rx_ok. Fix this warning by directly copying hw->stats,
> and refactor the unnecessarily complicated BUILD_BUG_ON btw.
>
> Signed-off-by: GONG, Ruiqi <gongruiqi1@...wei.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists