Commit 83df3570 authored by Yu Kuai's avatar Yu Kuai Committed by openeuler-sync-bot
Browse files

md/raid1-10: fix casting from randomized structure in raid1_submit_write()

mainline inclusion
from mainline-v6.5-rc1
commit b5a99602
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/?id=b5a99602b74bbfa655be509c615181dd95b0719e



----------------------------------------

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: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306142042.fmjfmTF8-lkp@intel.com/


Fixes: 8295efbe ("md/raid1-10: factor out a helper to submit normal write")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230616012136.3047071-1-yukuai1@huaweicloud.com



Conflict:
  Commit 309dca30 ("block: store a block_device pointer in struct bio")
  changed "bi_disk" to "bi_bdev", and in commit 8295efbe ("md/raid1-10:
  factor out a helper to submit normal write"), "bi_bdev" was adapted to
  "bi_disk".
Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
(cherry picked from commit e0e29b5e)
parent eae0bdb9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment