drivers/md/raid5-ppl.c:632:57: sparse: sparse: incorrect type in argument 3 (different base types)

From: kernel test robot
Date: Fri May 27 2022 - 16:47:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7e284070abe53d448517b80493863595af4ab5f0
commit: b0920ede081b3f1659872f80ce552305610675a6 md/raid5: Add __rcu annotation to struct disk_info
date: 5 weeks ago
config: csky-randconfig-s032-20220524 (https://download.01.org/0day-ci/archive/20220528/202205280426.NVpnRyuP-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 11.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-14-g5a0004b5-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0920ede081b3f1659872f80ce552305610675a6
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b0920ede081b3f1659872f80ce552305610675a6
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash drivers/md/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
drivers/md/raid5-ppl.c: note: in included file:
drivers/md/raid5.h:271:14: sparse: sparse: array of flexible structures
>> drivers/md/raid5-ppl.c:632:57: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int opf @@ got restricted gfp_t [usertype] @@
drivers/md/raid5-ppl.c:632:57: sparse: expected unsigned int opf
drivers/md/raid5-ppl.c:632:57: sparse: got restricted gfp_t [usertype]
>> drivers/md/raid5-ppl.c:633:61: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected restricted gfp_t [usertype] gfp_mask @@ got unsigned long long @@
drivers/md/raid5-ppl.c:633:61: sparse: expected restricted gfp_t [usertype] gfp_mask
drivers/md/raid5-ppl.c:633:61: sparse: got unsigned long long
drivers/md/raid5-ppl.c:886:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid5-ppl.c:886:30: sparse: expected struct md_rdev *rdev
drivers/md/raid5-ppl.c:886:30: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid5-ppl.c:937:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct md_rdev *parity_rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid5-ppl.c:937:29: sparse: expected struct md_rdev *parity_rdev
drivers/md/raid5-ppl.c:937:29: sparse: got struct md_rdev [noderef] __rcu *rdev
drivers/md/raid5-ppl.c:1407:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct md_rdev *rdev @@ got struct md_rdev [noderef] __rcu *rdev @@
drivers/md/raid5-ppl.c:1407:54: sparse: expected struct md_rdev *rdev
drivers/md/raid5-ppl.c:1407:54: sparse: got struct md_rdev [noderef] __rcu *rdev

vim +632 drivers/md/raid5-ppl.c

1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 607
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 608 static void ppl_do_flush(struct ppl_io_unit *io)
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 609 {
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 610 struct ppl_log *log = io->log;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 611 struct ppl_conf *ppl_conf = log->ppl_conf;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 612 struct r5conf *conf = ppl_conf->mddev->private;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 613 int raid_disks = conf->raid_disks;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 614 int flushed_disks = 0;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 615 int i;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 616
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 617 atomic_set(&io->pending_flushes, raid_disks);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 618
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 619 for_each_set_bit(i, &log->disk_flush_bitmap, raid_disks) {
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 620 struct md_rdev *rdev;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 621 struct block_device *bdev = NULL;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 622
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 623 rcu_read_lock();
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 624 rdev = rcu_dereference(conf->disks[i].rdev);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 625 if (rdev && !test_bit(Faulty, &rdev->flags))
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 626 bdev = rdev->bdev;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 627 rcu_read_unlock();
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 628
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 629 if (bdev) {
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 630 struct bio *bio;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 631
609be1066731fe Christoph Hellwig 2022-01-24 @632 bio = bio_alloc_bioset(bdev, 0, GFP_NOIO,
609be1066731fe Christoph Hellwig 2022-01-24 @633 REQ_OP_WRITE | REQ_PREFLUSH,
609be1066731fe Christoph Hellwig 2022-01-24 634 &ppl_conf->flush_bs);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 635 bio->bi_private = io;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 636 bio->bi_end_io = ppl_flush_endio;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 637
c7dec4623c9cde Christoph Hellwig 2022-03-04 638 pr_debug("%s: dev: %ps\n", __func__, bio->bi_bdev);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 639
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 640 submit_bio(bio);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 641 flushed_disks++;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 642 }
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 643 }
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 644
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 645 log->disk_flush_bitmap = 0;
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 646
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 647 for (i = flushed_disks ; i < raid_disks; i++) {
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 648 if (atomic_dec_and_test(&io->pending_flushes))
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 649 ppl_io_unit_finished(io);
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 650 }
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 651 }
1532d9e87e8b23 Tomasz Majchrzak 2017-12-27 652

:::::: The code at line 632 was first introduced by commit
:::::: 609be1066731fea86436f5f91022f82e592ab456 block: pass a block_device and opf to bio_alloc_bioset

:::::: TO: Christoph Hellwig <hch@xxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp