Search Linux Wireless

Re: [PATCH][next] zd1211rw: zd_usb: Use struct_size() helper

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

 



Hi "Gustavo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[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/Gustavo-A-R-Silva/zd1211rw-zd_usb-Use-struct_size-helper/20190831-161121
config: mips-allmodconfig (attached as .config)
compiler: mips-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=mips 

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

All warnings (new ones prefixed by >>):

   In file included from drivers/net/wireless/zydas/zd1211rw/zd_usb.c:22:0:
   drivers/net/wireless/zydas/zd1211rw/zd_usb.c: In function 'check_read_regs':
>> drivers/net/wireless/zydas/zd1211rw/zd_def.h:18:25: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t {aka unsigned int}' [-Wformat=]
     dev_printk(level, dev, "%s() " fmt, __func__, ##args)
                            ^
>> drivers/net/wireless/zydas/zd1211rw/zd_def.h:22:4: note: in expansion of macro 'dev_printk_f'
       dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
       ^~~~~~~~~~~~
>> drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1635:3: note: in expansion of macro 'dev_dbg_f'
      dev_dbg_f(zd_usb_dev(usb),
      ^~~~~~~~~
   drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1636:51: note: format string is defined here
        "error: actual length %d less than expected %ld\n",
                                                    ~~^
                                                    %d

vim +/dev_dbg_f +1635 drivers/net/wireless/zydas/zd1211rw/zd_usb.c

e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1622  
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1623  static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req,
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1624  			    unsigned int count)
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1625  {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1626  	int i;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1627  	struct zd_usb_interrupt *intr = &usb->intr;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1628  	struct read_regs_int *rr = &intr->read_regs;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1629  	struct usb_int_regs *regs = (struct usb_int_regs *)rr->buffer;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1630  
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1631  	/* The created block size seems to be larger than expected.
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1632  	 * However results appear to be correct.
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1633  	 */
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30  1634  	if (rr->length < struct_size(regs, regs, count)) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02 @1635  		dev_dbg_f(zd_usb_dev(usb),
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30  1636  			 "error: actual length %d less than expected %ld\n",
d352eeccec7e84 drivers/net/wireless/zydas/zd1211rw/zd_usb.c Gustavo A. R. Silva 2019-08-30  1637  			 rr->length, struct_size(regs, regs, count));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1638  		return false;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1639  	}
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1640  
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1641  	if (rr->length > sizeof(rr->buffer)) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1642  		dev_dbg_f(zd_usb_dev(usb),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1643  			 "error: actual length %d exceeds buffer size %zu\n",
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1644  			 rr->length, sizeof(rr->buffer));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1645  		return false;
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1646  	}
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1647  
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1648  	for (i = 0; i < count; i++) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1649  		struct reg_data *rd = &regs->regs[i];
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1650  		if (rd->addr != req->addr[i]) {
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1651  			dev_dbg_f(zd_usb_dev(usb),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1652  				 "rd[%d] addr %#06hx expected %#06hx\n", i,
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1653  				 le16_to_cpu(rd->addr),
e85d0918b54fbd drivers/net/wireless/zd1211rw/zd_usb.c       Daniel Drake        2006-06-02  1654  				 le16_to_cpu(req->addr[i]));
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1655  			return false;
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1656  		}
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1657  	}
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1658  
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1659  	return true;
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1660  }
c900eff30a14ec drivers/net/wireless/zd1211rw/zd_usb.c       Jussi Kivilinna     2011-06-20  1661  

:::::: The code at line 1635 was first introduced by commit
:::::: e85d0918b54fbd9b38003752f7d665416b06edd8 [PATCH] ZyDAS ZD1211 USB-WLAN driver

:::::: TO: Daniel Drake <dsd@xxxxxxxxxx>
:::::: CC: Jeff Garzik <jeff@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux