Re: [PATCH][next] nvme-loop: Avoid -Wflex-array-member-not-at-end warning

Chaitanya Kulkarni
2025-03-31T03:28:14Z

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