[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ceee2968cd7efa74c6a39147b14bb1b3bc3928c.1739957534.git.gustavoars@kernel.org>
Date: Mon, 24 Feb 2025 20:26:59 +1030
From: "Gustavo A. R. Silva" <gustavoars@...nel.org>
To: Song Liu <song@...nel.org>, Yu Kuai <yukuai3@...wei.com>
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-hardening@...r.kernel.org
Subject: [PATCH 2/8][next] md/raid5-ppl: Avoid -Wflex-array-member-not-at-end
warning
-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 member 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 the following warning:
drivers/md/raid5-ppl.c:153:20: 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@...nel.org>
---
drivers/md/raid5-ppl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index c0fb335311aa..f4333c644b67 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -150,7 +150,7 @@ struct ppl_io_unit {
bool submitted; /* true if write to log started */
/* inline bio and its biovec for submitting the iounit */
- struct bio bio;
+ struct bio_hdr bio;
struct bio_vec biovec[PPL_IO_INLINE_BVECS];
};
@@ -250,8 +250,8 @@ static struct ppl_io_unit *ppl_new_iounit(struct ppl_log *log,
INIT_LIST_HEAD(&io->stripe_list);
atomic_set(&io->pending_stripes, 0);
atomic_set(&io->pending_flushes, 0);
- bio_init(&io->bio, log->rdev->bdev, io->biovec, PPL_IO_INLINE_BVECS,
- REQ_OP_WRITE | REQ_FUA);
+ bio_init(container_of(&io->bio, struct bio, __hdr), log->rdev->bdev,
+ io->biovec, PPL_IO_INLINE_BVECS, REQ_OP_WRITE | REQ_FUA);
pplhdr = page_address(io->header_page);
clear_page(pplhdr);
@@ -430,7 +430,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io)
struct ppl_log *log = io->log;
struct ppl_conf *ppl_conf = log->ppl_conf;
struct ppl_header *pplhdr = page_address(io->header_page);
- struct bio *bio = &io->bio;
+ struct bio *bio = container_of(&io->bio, struct bio, __hdr);
struct stripe_head *sh;
int i;
--
2.43.0
Powered by blists - more mailing lists