[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7fzsd7aH/tCAMyf@shredder>
Date: Fri, 6 Jan 2023 12:10:57 +0200
From: Ido Schimmel <idosch@...dia.com>
To: Kees Cook <keescook@...omium.org>
Cc: Petr Machata <petrm@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] mlxsw: spectrum_router: Replace 0-length array with
flexible array
On Thu, Jan 05, 2023 at 03:22:29PM -0800, Kees Cook wrote:
> Zero-length arrays are deprecated[1]. Replace struct
> mlxsw_sp_nexthop_group_info's "nexthops" 0-length array with a flexible
> array. Detected with GCC 13, using -fstrict-flex-arrays=3:
>
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c: In function 'mlxsw_sp_nexthop_group_hash_obj':
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3278:38: warning: array subscript i is outside array bounds of 'struct mlxsw_sp_nexthop[0]' [-Warray-bounds=]
> 3278 | val ^= jhash(&nh->ifindex, sizeof(nh->ifindex), seed);
> | ^~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:2954:33: note: while referencing 'nexthops'
> 2954 | struct mlxsw_sp_nexthop nexthops[0];
> | ^~~~~~~~
>
> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
>
> Cc: Ido Schimmel <idosch@...dia.com>
> Cc: Petr Machata <petrm@...dia.com>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: netdev@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Ido Schimmel <idosch@...dia.com>
Thanks
Powered by blists - more mailing lists