[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y72SkdnBkwxQYXoT@nanopsycho>
Date: Tue, 10 Jan 2023 17:30:09 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Kees Cook <keescook@...omium.org>
Cc: Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
"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-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net/mlx5e: Replace 0-length array with flexible array
Thu, Jan 05, 2023 at 11:36:43PM CET, keescook@...omium.org wrote:
>Zero-length arrays are deprecated[1]. Replace struct mlx5e_rx_wqe_cyc's
>"data" 0-length array with a flexible array. Detected with GCC 13,
>using -fstrict-flex-arrays=3:
>
>drivers/net/ethernet/mellanox/mlx5/core/en_main.c: In function 'mlx5e_alloc_rq':
>drivers/net/ethernet/mellanox/mlx5/core/en_main.c:827:42: warning: array subscript f is outside array bounds of 'struct mlx5_wqe_data_seg[0]' [-Warray-bounds=]
> 827 | wqe->data[f].byte_count = 0;
> | ~~~~~~~~~^~~
>In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h:11,
> from drivers/net/ethernet/mellanox/mlx5/core/eswitch.h:48,
> from drivers/net/ethernet/mellanox/mlx5/core/en_main.c:42:
>drivers/net/ethernet/mellanox/mlx5/core/en.h:250:39: note: while referencing 'data'
> 250 | struct mlx5_wqe_data_seg data[0];
> | ^~~~
>
>[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
>
>Cc: Saeed Mahameed <saeedm@...dia.com>
>Cc: Leon Romanovsky <leon@...nel.org>
>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
>Cc: linux-rdma@...r.kernel.org
>Signed-off-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists