Skip to content

Commit

Permalink
md/raid1-10: fix casting from randomized structure in raid1_submit_wr…
Browse files Browse the repository at this point in the history
…ite()

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: 8295efb ("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
  • Loading branch information
YuKuai-huawei authored and liu-song-6 committed Jun 23, 2023
1 parent 125bfc7 commit b5a9960
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/raid1-10.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,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_bdev;
struct md_rdev *rdev = (void *)bio->bi_bdev;

bio->bi_next = NULL;
bio_set_dev(bio, rdev->bdev);
Expand Down

0 comments on commit b5a9960

Please sign in to comment.