lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 27 May 2022 15:18:20 -0600
From:   Logan Gunthorpe <logang@...tatee.com>
To:     kernel test robot <lkp@...el.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Song Liu <song@...nel.org>, Christoph Hellwig <hch@....de>
Subject: Re: drivers/md/raid5-ppl.c:632:57: sparse: sparse: incorrect type in
 argument 3 (different base types)



On 2022-05-27 14:46, kernel test robot wrote:
> 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@intel.com/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@...el.com>
> 
> 
> 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);

Something is odd about this report. Seems like the new sparse errors
were caused by this commit, not the one I sent that was noted at the top
of this email.

Looks like the arguments in bio_alloc_bioset are incorrectly reversed in
609be10667 and this hasn't been fixed yet, at least not in Linus's tree.

The patch I sent (b0920ede081b3f) may have introduced some of the rdev
sparse warnings in this report, but these were fixed up a couple commits
later (4f4ee2bf3).

Logan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ