
From: Yu Kuai <yukuai3@huawei.com> mainline inclusion from mainline-v6.5-rc1 commit b5a99602b74bbfa655be509c615181dd95b0719e category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8UKFJ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... ---------------------------------------- Following build error triggered while build with clang version 17.0.0 with W=1(this can't be reporduced with gcc 13.1.0): drivers/md/raid1-10.c:117:25: error: casting from randomized structure pointer type 'struct block_device *' to 'struct md_rdev *' 117 | struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev; | ^ Fix this by casting 'bio->bi_bdev' to 'void *', as it used to be. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202306142042.fmjfmTF8-lkp@intel.com/ Fixes: 8295efbe68c0 ("md/raid1-10: factor out a helper to submit normal write") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230616012136.3047071-1-yukuai1@huaweicloud.com Conflict: Commit 309dca309fc3 ("block: store a block_device pointer in struct bio") changed "bi_disk" to "bi_bdev", and in commit 8295efbe68c0 ("md/raid1-10: factor out a helper to submit normal write"), "bi_bdev" was adapted to "bi_disk". Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com> --- drivers/md/raid1-10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index c2f0fbbf92c4..5cada8fa4af7 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -115,7 +115,7 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, static inline void raid1_submit_write(struct bio *bio) { - struct md_rdev *rdev = (struct md_rdev *)bio->bi_disk; + struct md_rdev *rdev = (void *)bio->bi_disk; bio->bi_next = NULL; bio_set_dev(bio, rdev->bdev); -- 2.31.1