From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Christoph Hellwig <hch@lst.de>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH 6/8][next] nvme: target: Avoid -Wflex-array-member-not-at-end warnings
Date: Tue, 25 Feb 2025 12:21:15 +1030 [thread overview]
Message-ID: <c3c28d70-540b-4034-8a89-8a6c4dcf17ab@embeddedor.com> (raw)
In-Reply-To: <20250224141938.GB1088@lst.de>
On 25/02/25 00:49, Christoph Hellwig wrote:
> On Mon, Feb 24, 2025 at 08:30:10PM +1030, 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.
>>
>> Change the type of the middle struct members currently causing trouble
>> from `struct bio` to `struct bio_hdr`.
>>
>> We also use `container_of()` whenever we need to retrieve a pointer to
>> the flexible structure `struct bio`, through which we can access the
>> flexible-array member in it, if necessary.
>>
>> With these changes fix 38 of the following warnings:
>>
>> drivers/nvme/target/nvmet.h:455:49: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>> drivers/nvme/target/nvmet.h:462:49: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>>
>
> I'm not sure where you bio_hdr structure comes from, but maybe that's
> because you annoyingly split CC over the series, and by the number of
> patches probably also bundled unrelated changes.
Ugh, yes, I messed up my script just before creating the series.
>
> In general our first resort here should be to move embedded bio to the
> of containing structures. If that's not possible you'll need to explain
> why.
>
Yes. Also, thanks for the feedback in your other response. I'll try to
follow that approach and see how it goes.
--
Gustavo
next prev parent reply other threads:[~2025-02-25 1:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 9:53 [PATCH 0/8][next] Avoid a couple hundred -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-02-24 9:55 ` [PATCH 1/8][next] block: blk_types.h: Use struct_group_tagged() in flex struct bio Gustavo A. R. Silva
2025-02-24 16:39 ` Christoph Hellwig
2025-02-24 9:56 ` [PATCH 2/8][next] md/raid5-ppl: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-02-24 9:57 ` [PATCH 3/8][next] xfs: Avoid -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2025-02-24 19:12 ` Darrick J. Wong
2025-02-24 21:45 ` Dave Chinner
2025-02-24 9:58 ` [PATCH 4/8][next] erofs: " Gustavo A. R. Silva
2025-02-24 9:59 ` [PATCH 5/8][next] btrfs: " Gustavo A. R. Silva
2025-02-24 10:00 ` [PATCH 6/8][next] nvme: target: " Gustavo A. R. Silva
2025-02-24 14:19 ` Christoph Hellwig
2025-02-25 1:51 ` Gustavo A. R. Silva [this message]
2025-02-24 10:00 ` [PATCH 7/8][next] md/raid5: " Gustavo A. R. Silva
2025-02-24 10:01 ` [PATCH 8/8][next] bcache: " Gustavo A. R. Silva
2025-02-24 14:04 ` Coly Li
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=c3c28d70-540b-4034-8a89-8a6c4dcf17ab@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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