On Tue, Feb 06, 2024 at 08:16:54AM -0800, Kees Cook wrote:
> Since NUM_XMIT_BUFFS is always 1, building m68k with sun3_defconfig and
> -Warraybounds, this build warning is visible[1]:
> 
> drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout':
> drivers/net/ethernet/i825xx/sun3_82586.c:990:122: warning: array subscript 1 
> is above array bounds of 'volatile struct transmit_cmd_struct *[1]' 
> [-Warray-bounds=]
>   990 |                 printk("%s: command-stats: %04x 
> %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
>       |                                                                       
>                                         ~~~~~~~~~~~~^~~
> ...
> drivers/net/ethernet/i825xx/sun3_82586.c:156:46: note: while referencing 
> 'xmit_cmds'
>   156 |         volatile struct transmit_cmd_struct 
> *xmit_cmds[NUM_XMIT_BUFFS];
> 
> Avoid accessing index 1 since it doesn't exist.
> 
> Link: https://github.com/KSPP/linux/issues/325 [1]
> Cc: Sam Creasey <sa...@sammy.net>
> Cc: "David S. Miller" <da...@davemloft.net>
> Cc: Eric Dumazet <eduma...@google.com>
> Cc: Jakub Kicinski <k...@kernel.org>
> Cc: Paolo Abeni <pab...@redhat.com>
> Cc: Gustavo A. R. Silva <gustavo...@kernel.org>
> Cc: net...@vger.kernel.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>

Reviewed-by: Simon Horman <ho...@kernel.org>
Tested-by: Simon Horman <ho...@kernel.org> # build-tested

...

Reply via email to