-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 <gustavo...@kernel.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


Reply via email to