-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 10 of the following warnings: drivers/md/raid5.h:262:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/md/raid5.h:262:38: 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@xxxxxxxxxx> --- drivers/md/raid5.c | 10 +++++----- drivers/md/raid5.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 5c79429acc64..76981d8cbc5d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1178,8 +1178,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) again: dev = &sh->dev[i]; - bi = &dev->req; - rbi = &dev->rreq; /* For writing to replacement */ + bi = container_of(&dev->req, struct bio, __hdr); + rbi = container_of(&dev->rreq, struct bio, __hdr); /* For writing to replacement */ rdev = conf->disks[i].rdev; rrdev = conf->disks[i].replacement; @@ -2720,7 +2720,7 @@ static void raid5_end_read_request(struct bio * bi) sector_t s; for (i=0 ; i<disks; i++) - if (bi == &sh->dev[i].req) + if (bi == container_of(&sh->dev[i].req, struct bio, __hdr)) break; pr_debug("end_read_request %llu/%d, count: %d, error %d.\n", @@ -2848,11 +2848,11 @@ static void raid5_end_write_request(struct bio *bi) int replacement = 0; for (i = 0 ; i < disks; i++) { - if (bi == &sh->dev[i].req) { + if (bi == container_of(&sh->dev[i].req, struct bio, __hdr)) { rdev = conf->disks[i].rdev; break; } - if (bi == &sh->dev[i].rreq) { + if (bi == container_of(&sh->dev[i].rreq, struct bio, __hdr)) { rdev = conf->disks[i].replacement; if (rdev) replacement = 1; diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index eafc6e9ed6ee..3df59302e953 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -259,7 +259,7 @@ struct stripe_head { /* rreq and rvec are used for the replacement device when * writing data to both devices. */ - struct bio req, rreq; + struct bio_hdr req, rreq; struct bio_vec vec, rvec; struct page *page, *orig_page; unsigned int offset; /* offset of the page */ -- 2.43.0