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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2025-03-31  3:28 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni
  Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org

On 3/28/25 07:25, Gustavo A. R. Silva wrote:
> -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.

Indeed :-

  18 struct nvme_loop_iod {
  19         struct nvme_request     nvme_req;
  20         struct nvme_command     cmd;
  21         struct nvme_completion  cqe;
  22         struct nvmet_req        req;
  23         struct nvme_loop_queue  *queue;
  24         struct work_struct      work;
  25         struct sg_table sg_table;
  26         struct scatterlist      first_sgl[];
  27 };


> 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>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2025-04-03  4:45 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, linux-kernel,
	linux-hardening

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  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-22  7:57 ` Christoph Hellwig
  4 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2025-04-14 22:11 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Christoph Hellwig, Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel, linux-hardening

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  2025-03-28 14:25 [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
                   ` (2 preceding siblings ...)
  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  7:57 ` Christoph Hellwig
  4 siblings, 1 reply; 8+ messages in thread
From: Gustavo A. R. Silva @ 2025-04-16  0:20 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel, linux-hardening, Kees Cook

Hi all,

Friendly ping: who can take this patch, please? :)

Thanks!
-Gustavo

On 28/03/25 08:25, Gustavo A. R. Silva wrote:
> -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)


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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2025-04-16  5:43 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni, linux-nvme, linux-kernel, linux-hardening,
	Kees Cook

On Tue, Apr 15, 2025 at 06:20:03PM -0600, Gustavo A. R. Silva wrote:
> Hi all,
>
> Friendly ping: who can take this patch, please? :)

This will go into the 6.16 nvme branch as soon as it opens.


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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  2025-03-28 14:25 [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
                   ` (3 preceding siblings ...)
  2025-04-16  0:20 ` Gustavo A. R. Silva
@ 2025-04-22  7:57 ` Christoph Hellwig
  4 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2025-04-22  7:57 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, linux-kernel,
	linux-hardening

Thanks,

applied to nvme-6.16.


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

* Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning
  2025-04-16  5:43   ` Christoph Hellwig
@ 2025-04-22 14:59     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 8+ messages in thread
From: Gustavo A. R. Silva @ 2025-04-22 14:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Gustavo A. R. Silva, Sagi Grimberg, Chaitanya Kulkarni,
	linux-nvme, linux-kernel, linux-hardening, Kees Cook



On 15/04/25 23:43, Christoph Hellwig wrote:
> On Tue, Apr 15, 2025 at 06:20:03PM -0600, Gustavo A. R. Silva wrote:
>> Hi all,
>>
>> Friendly ping: who can take this patch, please? :)
> 
> This will go into the 6.16 nvme branch as soon as it opens.

Awesome. :)

Thanks

-Gustavo


^ permalink raw reply	[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