public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
@ 2025-03-28 14:25 Gustavo A. R. Silva
  2025-03-31  3:28 ` Chaitanya Kulkarni
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Gustavo A. R. Silva @ 2025-03-28 14:25 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel, Gustavo A. R. Silva, linux-hardening

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the structure. Notice
that `struct nvme_loop_iod` is a flexible structure --a structure
that contains a flexible-array member.

Fix the following warning:

drivers/nvme/target/loop.c:36:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/nvme/target/loop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index a5c41144667c..d02b80803278 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -33,10 +33,12 @@ struct nvme_loop_ctrl {
 
 	struct list_head	list;
 	struct blk_mq_tag_set	tag_set;
-	struct nvme_loop_iod	async_event_iod;
 	struct nvme_ctrl	ctrl;
 
 	struct nvmet_port	*port;
+
+	/* Must be last --ends in a flexible-array member. */
+	struct nvme_loop_iod	async_event_iod;
 };
 
 static inline struct nvme_loop_ctrl *to_loop_ctrl(struct nvme_ctrl *ctrl)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-22 14:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 14:25 [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-03-31  3:28 ` Chaitanya Kulkarni
2025-04-03  4:45 ` Christoph Hellwig
2025-04-14 22:11 ` Sagi Grimberg
2025-04-16  0:20 ` Gustavo A. R. Silva
2025-04-16  5:43   ` Christoph Hellwig
2025-04-22 14:59     ` Gustavo A. R. Silva
2025-04-22  7:57 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox