Re: [PATCH] scsi: sd_zbc: Improve zone revalidation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Damien,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next next-20200730]
[cannot apply to target/for-next v5.8-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Damien-Le-Moal/scsi-sd_zbc-Improve-zone-revalidation/20200730-214245
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-a013-20200730 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 6700f4b9fe6321ef704efa4890af5bc351a124f0)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/scsi/sd_zbc.c:678:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (sdkp->zone_blocks == zone_blocks &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/sd_zbc.c:714:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/scsi/sd_zbc.c:678:2: note: remove the 'if' if its condition is always false
           if (sdkp->zone_blocks == zone_blocks &&
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/sd_zbc.c:667:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.

vim +678 drivers/scsi/sd_zbc.c

5795eb44306014 Johannes Thumshirn 2020-05-12  659  
3dd6d693a9953a Damien Le Moal     2020-07-30  660  int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
5795eb44306014 Johannes Thumshirn 2020-05-12  661  {
5795eb44306014 Johannes Thumshirn 2020-05-12  662  	struct gendisk *disk = sdkp->disk;
3dd6d693a9953a Damien Le Moal     2020-07-30  663  	struct request_queue *q = disk->queue;
3dd6d693a9953a Damien Le Moal     2020-07-30  664  	u32 zone_blocks = sdkp->rev_zone_blocks;
3dd6d693a9953a Damien Le Moal     2020-07-30  665  	unsigned int nr_zones = sdkp->rev_nr_zones;
3dd6d693a9953a Damien Le Moal     2020-07-30  666  	u32 max_append;
3dd6d693a9953a Damien Le Moal     2020-07-30  667  	int ret;
3dd6d693a9953a Damien Le Moal     2020-07-30  668  
3dd6d693a9953a Damien Le Moal     2020-07-30  669  	if (!sd_is_zoned(sdkp))
3dd6d693a9953a Damien Le Moal     2020-07-30  670  		return 0;
5795eb44306014 Johannes Thumshirn 2020-05-12  671  
5795eb44306014 Johannes Thumshirn 2020-05-12  672  	/*
5795eb44306014 Johannes Thumshirn 2020-05-12  673  	 * Make sure revalidate zones are serialized to ensure exclusive
5795eb44306014 Johannes Thumshirn 2020-05-12  674  	 * updates of the scsi disk data.
5795eb44306014 Johannes Thumshirn 2020-05-12  675  	 */
5795eb44306014 Johannes Thumshirn 2020-05-12  676  	mutex_lock(&sdkp->rev_mutex);
5795eb44306014 Johannes Thumshirn 2020-05-12  677  
5795eb44306014 Johannes Thumshirn 2020-05-12 @678  	if (sdkp->zone_blocks == zone_blocks &&
5795eb44306014 Johannes Thumshirn 2020-05-12  679  	    sdkp->nr_zones == nr_zones &&
5795eb44306014 Johannes Thumshirn 2020-05-12  680  	    disk->queue->nr_zones == nr_zones)
5795eb44306014 Johannes Thumshirn 2020-05-12  681  		goto unlock;
5795eb44306014 Johannes Thumshirn 2020-05-12  682  
3dd6d693a9953a Damien Le Moal     2020-07-30  683  	sdkp->zone_blocks = zone_blocks;
3dd6d693a9953a Damien Le Moal     2020-07-30  684  	sdkp->nr_zones = nr_zones;
5795eb44306014 Johannes Thumshirn 2020-05-12  685  	sdkp->rev_wp_offset = kvcalloc(nr_zones, sizeof(u32), GFP_NOIO);
5795eb44306014 Johannes Thumshirn 2020-05-12  686  	if (!sdkp->rev_wp_offset) {
5795eb44306014 Johannes Thumshirn 2020-05-12  687  		ret = -ENOMEM;
5795eb44306014 Johannes Thumshirn 2020-05-12  688  		goto unlock;
5795eb44306014 Johannes Thumshirn 2020-05-12  689  	}
5795eb44306014 Johannes Thumshirn 2020-05-12  690  
5795eb44306014 Johannes Thumshirn 2020-05-12  691  	ret = blk_revalidate_disk_zones(disk, sd_zbc_revalidate_zones_cb);
5795eb44306014 Johannes Thumshirn 2020-05-12  692  
5795eb44306014 Johannes Thumshirn 2020-05-12  693  	kvfree(sdkp->rev_wp_offset);
5795eb44306014 Johannes Thumshirn 2020-05-12  694  	sdkp->rev_wp_offset = NULL;
5795eb44306014 Johannes Thumshirn 2020-05-12  695  
3dd6d693a9953a Damien Le Moal     2020-07-30  696  	if (ret) {
3dd6d693a9953a Damien Le Moal     2020-07-30  697  		sdkp->zone_blocks = 0;
3dd6d693a9953a Damien Le Moal     2020-07-30  698  		sdkp->nr_zones = 0;
3dd6d693a9953a Damien Le Moal     2020-07-30  699  		sdkp->capacity = 0;
3dd6d693a9953a Damien Le Moal     2020-07-30  700  		goto unlock;
3dd6d693a9953a Damien Le Moal     2020-07-30  701  	}
3dd6d693a9953a Damien Le Moal     2020-07-30  702  
3dd6d693a9953a Damien Le Moal     2020-07-30  703  	max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks),
3dd6d693a9953a Damien Le Moal     2020-07-30  704  			   q->limits.max_segments << (PAGE_SHIFT - 9));
3dd6d693a9953a Damien Le Moal     2020-07-30  705  	max_append = min_t(u32, max_append, queue_max_hw_sectors(q));
3dd6d693a9953a Damien Le Moal     2020-07-30  706  
3dd6d693a9953a Damien Le Moal     2020-07-30  707  	blk_queue_max_zone_append_sectors(q, max_append);
3dd6d693a9953a Damien Le Moal     2020-07-30  708  
3dd6d693a9953a Damien Le Moal     2020-07-30  709  	sd_zbc_print_zones(sdkp);
3dd6d693a9953a Damien Le Moal     2020-07-30  710  
5795eb44306014 Johannes Thumshirn 2020-05-12  711  unlock:
5795eb44306014 Johannes Thumshirn 2020-05-12  712  	mutex_unlock(&sdkp->rev_mutex);
5795eb44306014 Johannes Thumshirn 2020-05-12  713  
5795eb44306014 Johannes Thumshirn 2020-05-12  714  	return ret;
5795eb44306014 Johannes Thumshirn 2020-05-12  715  }
5795eb44306014 Johannes Thumshirn 2020-05-12  716  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux