From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Kees Cook <keescook@chromium.org>,
Leon Romanovsky <leon@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-rdma@vger.kernel.org, Jiri Pirko <jiri@nvidia.com>
Subject: [net-next 13/15] net/mlx5e: Replace 0-length array with flexible array
Date: Tue, 10 Jan 2023 21:30:43 -0800 [thread overview]
Message-ID: <20230111053045.413133-14-saeed@kernel.org> (raw)
In-Reply-To: <20230111053045.413133-1-saeed@kernel.org>
From: Kees Cook <keescook@chromium.org>
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@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 7cbd71f0b8ae..82573ac722d1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -247,7 +247,7 @@ struct mlx5e_rx_wqe_ll {
};
struct mlx5e_rx_wqe_cyc {
- struct mlx5_wqe_data_seg data[0];
+ DECLARE_FLEX_ARRAY(struct mlx5_wqe_data_seg, data);
};
struct mlx5e_umr_wqe {
--
2.39.0
next prev parent reply other threads:[~2023-01-11 5:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 5:30 [pull request][net-next 00/15] mlx5 updates 2023-01-10 Saeed Mahameed
2023-01-11 5:30 ` [net-next 01/15] net/mlx5: Expose shared buffer registers bits and structs Saeed Mahameed
2023-01-11 9:10 ` patchwork-bot+netdevbpf
2023-01-11 5:30 ` [net-next 02/15] net/mlx5e: Add API to query/modify SBPR and SBCM registers Saeed Mahameed
2023-01-11 5:30 ` [net-next 03/15] net/mlx5e: Update shared buffer along with device buffer changes Saeed Mahameed
2023-01-11 5:30 ` [net-next 04/15] net/mlx5e: Add Ethernet driver debugfs Saeed Mahameed
2023-01-11 5:30 ` [net-next 05/15] net/mlx5e: kTLS, Add debugfs Saeed Mahameed
2023-01-11 18:32 ` Jakub Kicinski
2023-01-11 20:20 ` Saeed Mahameed
2023-01-11 20:52 ` Jakub Kicinski
2023-01-11 5:30 ` [net-next 06/15] net/mlx5e: Add hairpin params structure Saeed Mahameed
2023-01-11 5:30 ` [net-next 07/15] net/mlx5e: Add flow steering debugfs directory Saeed Mahameed
2023-01-11 5:30 ` [net-next 08/15] net/mlx5e: Add hairpin debugfs files Saeed Mahameed
2023-01-11 18:34 ` Jakub Kicinski
2023-01-11 20:46 ` Saeed Mahameed
2023-01-11 21:03 ` Jakub Kicinski
2023-01-11 23:01 ` Saeed Mahameed
2023-01-12 3:46 ` Jakub Kicinski
2023-01-12 9:17 ` Gal Pressman
2023-01-12 22:20 ` Jakub Kicinski
2023-01-15 10:04 ` Gal Pressman
2023-01-17 18:48 ` Jakub Kicinski
2023-01-11 5:30 ` [net-next 09/15] net/mlx5: Enable management PF initialization Saeed Mahameed
2023-01-11 5:30 ` [net-next 10/15] net/mlx5: Introduce and use opcode getter in command interface Saeed Mahameed
2023-01-11 5:30 ` [net-next 11/15] net/mlx5: Prevent high-rate FW commands from populating all slots Saeed Mahameed
2023-01-11 5:30 ` [net-next 12/15] net/mlx5e: Replace zero-length array with flexible-array member Saeed Mahameed
2023-01-11 5:30 ` Saeed Mahameed [this message]
2023-01-11 5:30 ` [net-next 14/15] net/mlx5: remove redundant ret variable Saeed Mahameed
2023-01-11 5:30 ` [net-next 15/15] net/mlx5e: Use kzalloc() in mlx5e_accel_fs_tcp_create() Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230111053045.413133-14-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gustavoars@kernel.org \
--cc=jiri@nvidia.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).