[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPhsuW6aSvCEa1khjjmDYGozUEs+Tx75RxfaE1+xL2Y1T6aN=Q@mail.gmail.com>
Date: Thu, 15 Jun 2023 23:27:47 -0700
From: Song Liu <song@...nel.org>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: axboe@...nel.dk, nathan@...nel.org, ndesaulniers@...gle.com,
yukuai3@...wei.com, linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH] md/raid1-10: fix casting from randomized structure in raid1_submit_write()
On Thu, Jun 15, 2023 at 6:26 PM Yu Kuai <yukuai1@...weicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@...wei.com>
>
> 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@...el.com>
> Link: 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@...wei.com>
Applied to md-next.
Thanks,
Song
> ---
> 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 169ebe296f2d..3f22edec70e7 100644
> --- a/drivers/md/raid1-10.c
> +++ b/drivers/md/raid1-10.c
> @@ -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);
> --
> 2.39.2
>
Powered by blists - more mailing lists