Re: [PATCH V2 06/15] scsi: pmcraid: use sg helper to operate sgl

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

 



Hi Ming,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on scsi/for-next]
[also build test ERROR on v5.2-rc4 next-20190613]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ming-Lei/scsi-use-sg-helper-to-operate-sgl/20190614-134223
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=xtensa 

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

All errors (new ones prefixed by >>):

   drivers//scsi/pmcraid.c: In function 'pmcraid_copy_sglist':
>> drivers//scsi/pmcraid.c:3282:2: error: 'scatterlist' undeclared (first use in this function)
     scatterlist = sglist->scatterlist;
     ^~~~~~~~~~~
   drivers//scsi/pmcraid.c:3282:2: note: each undeclared identifier is reported only once for each function it appears in

vim +/scatterlist +3282 drivers//scsi/pmcraid.c

89a36810 Anil Ravindranath 2009-08-25  3253  
89a36810 Anil Ravindranath 2009-08-25  3254  /**
89a36810 Anil Ravindranath 2009-08-25  3255   * pmcraid_copy_sglist - Copy user buffer to kernel buffer's SG list
89a36810 Anil Ravindranath 2009-08-25  3256   * @sglist: scatter/gather list pointer
89a36810 Anil Ravindranath 2009-08-25  3257   * @buffer: buffer pointer
89a36810 Anil Ravindranath 2009-08-25  3258   * @len: buffer length
89a36810 Anil Ravindranath 2009-08-25  3259   * @direction: data transfer direction
89a36810 Anil Ravindranath 2009-08-25  3260   *
89a36810 Anil Ravindranath 2009-08-25  3261   * Copy a user buffer into a buffer allocated by pmcraid_alloc_sglist
89a36810 Anil Ravindranath 2009-08-25  3262   *
89a36810 Anil Ravindranath 2009-08-25  3263   * Return value:
89a36810 Anil Ravindranath 2009-08-25  3264   * 0 on success / other on failure
89a36810 Anil Ravindranath 2009-08-25  3265   */
89a36810 Anil Ravindranath 2009-08-25  3266  static int pmcraid_copy_sglist(
89a36810 Anil Ravindranath 2009-08-25  3267  	struct pmcraid_sglist *sglist,
3397623b Arnd Bergmann     2017-04-20  3268  	void __user *buffer,
89a36810 Anil Ravindranath 2009-08-25  3269  	u32 len,
89a36810 Anil Ravindranath 2009-08-25  3270  	int direction
89a36810 Anil Ravindranath 2009-08-25  3271  )
89a36810 Anil Ravindranath 2009-08-25  3272  {
4555938c Ming Lei          2019-06-13  3273  	struct scatterlist *sg;
89a36810 Anil Ravindranath 2009-08-25  3274  	void *kaddr;
89a36810 Anil Ravindranath 2009-08-25  3275  	int bsize_elem;
89a36810 Anil Ravindranath 2009-08-25  3276  	int i;
89a36810 Anil Ravindranath 2009-08-25  3277  	int rc = 0;
89a36810 Anil Ravindranath 2009-08-25  3278  
89a36810 Anil Ravindranath 2009-08-25  3279  	/* Determine the actual number of bytes per element */
89a36810 Anil Ravindranath 2009-08-25  3280  	bsize_elem = PAGE_SIZE * (1 << sglist->order);
89a36810 Anil Ravindranath 2009-08-25  3281  
89a36810 Anil Ravindranath 2009-08-25 @3282  	scatterlist = sglist->scatterlist;
89a36810 Anil Ravindranath 2009-08-25  3283  
4555938c Ming Lei          2019-06-13  3284  	for (i = 0; i < (len / bsize_elem); i++, sg = sg_next(sg), buffer += bsize_elem) {
4555938c Ming Lei          2019-06-13  3285  		struct page *page = sg_page(sg);
89a36810 Anil Ravindranath 2009-08-25  3286  
89a36810 Anil Ravindranath 2009-08-25  3287  		kaddr = kmap(page);
89a36810 Anil Ravindranath 2009-08-25  3288  		if (direction == DMA_TO_DEVICE)
edb88cef Arnd Bergmann     2017-04-22  3289  			rc = copy_from_user(kaddr, buffer, bsize_elem);
89a36810 Anil Ravindranath 2009-08-25  3290  		else
edb88cef Arnd Bergmann     2017-04-22  3291  			rc = copy_to_user(buffer, kaddr, bsize_elem);
89a36810 Anil Ravindranath 2009-08-25  3292  
89a36810 Anil Ravindranath 2009-08-25  3293  		kunmap(page);
89a36810 Anil Ravindranath 2009-08-25  3294  
89a36810 Anil Ravindranath 2009-08-25  3295  		if (rc) {
89a36810 Anil Ravindranath 2009-08-25  3296  			pmcraid_err("failed to copy user data into sg list\n");
89a36810 Anil Ravindranath 2009-08-25  3297  			return -EFAULT;
89a36810 Anil Ravindranath 2009-08-25  3298  		}
89a36810 Anil Ravindranath 2009-08-25  3299  
4555938c Ming Lei          2019-06-13  3300  		sg->length = bsize_elem;
89a36810 Anil Ravindranath 2009-08-25  3301  	}
89a36810 Anil Ravindranath 2009-08-25  3302  
89a36810 Anil Ravindranath 2009-08-25  3303  	if (len % bsize_elem) {
4555938c Ming Lei          2019-06-13  3304  		struct page *page = sg_page(sg);
89a36810 Anil Ravindranath 2009-08-25  3305  
89a36810 Anil Ravindranath 2009-08-25  3306  		kaddr = kmap(page);
89a36810 Anil Ravindranath 2009-08-25  3307  
89a36810 Anil Ravindranath 2009-08-25  3308  		if (direction == DMA_TO_DEVICE)
edb88cef Arnd Bergmann     2017-04-22  3309  			rc = copy_from_user(kaddr, buffer, len % bsize_elem);
89a36810 Anil Ravindranath 2009-08-25  3310  		else
edb88cef Arnd Bergmann     2017-04-22  3311  			rc = copy_to_user(buffer, kaddr, len % bsize_elem);
89a36810 Anil Ravindranath 2009-08-25  3312  
89a36810 Anil Ravindranath 2009-08-25  3313  		kunmap(page);
89a36810 Anil Ravindranath 2009-08-25  3314  
4555938c Ming Lei          2019-06-13  3315  		sg->length = len % bsize_elem;
89a36810 Anil Ravindranath 2009-08-25  3316  	}
89a36810 Anil Ravindranath 2009-08-25  3317  
89a36810 Anil Ravindranath 2009-08-25  3318  	if (rc) {
89a36810 Anil Ravindranath 2009-08-25  3319  		pmcraid_err("failed to copy user data into sg list\n");
89a36810 Anil Ravindranath 2009-08-25  3320  		rc = -EFAULT;
89a36810 Anil Ravindranath 2009-08-25  3321  	}
89a36810 Anil Ravindranath 2009-08-25  3322  
89a36810 Anil Ravindranath 2009-08-25  3323  	return rc;
89a36810 Anil Ravindranath 2009-08-25  3324  }
89a36810 Anil Ravindranath 2009-08-25  3325  

:::::: The code at line 3282 was first introduced by commit
:::::: 89a3681041507773dfee1b88c1c90c8a811a79d3 [SCSI] pmcraid: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller

:::::: TO: Anil Ravindranath <anil_ravindranath@xxxxxxxxxxxxxx>
:::::: CC: James Bottomley <James.Bottomley@xxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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