Re: [PATCH] gspca: zero usb_buf on error

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

 



Hi Hans,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[cannot apply to v5.3-rc4 next-20190814]
[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/Hans-Verkuil/gspca-zero-usb_buf-on-error/20190816-123155
base:   git://linuxtv.org/media_tree.git master
config: ia64-allmodconfig (attached as .config)
compiler: ia64-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=ia64 

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

All warnings (new ones prefixed by >>):

   drivers/media/usb/gspca/nw80x.c: In function 'reg_r':
>> drivers/media/usb/gspca/nw80x.c:1579:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/sn9c20x.c: In function 'reg_r':
>> drivers/media/usb/gspca/sn9c20x.c:916:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/sonixj.c: In function 'reg_r':
>> drivers/media/usb/gspca/sonixj.c:1169:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/spca1528.c: In function 'reg_r':
>> drivers/media/usb/gspca/spca1528.c:78:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/sq930x.c: In function 'reg_r':
>> drivers/media/usb/gspca/sq930x.c:432:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/sunplus.c: In function 'reg_r':
>> drivers/media/usb/gspca/sunplus.c:262:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^
--
   drivers/media/usb/gspca/vc032x.c: In function 'reg_r_i':
>> drivers/media/usb/gspca/vc032x.c:2913:39: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
      memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
                                          ^

vim +1579 drivers/media/usb/gspca/nw80x.c

  1556	
  1557	/* -- read registers in usb_buf -- */
  1558	static void reg_r(struct gspca_dev *gspca_dev,
  1559				u16 index,
  1560				int len)
  1561	{
  1562		struct usb_device *dev = gspca_dev->dev;
  1563		int ret;
  1564	
  1565		if (gspca_dev->usb_err < 0)
  1566			return;
  1567		ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
  1568				0x00,
  1569				USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1570				0x00, index,
  1571				gspca_dev->usb_buf, len, 500);
  1572		if (ret < 0) {
  1573			pr_err("reg_r err %d\n", ret);
  1574			gspca_dev->usb_err = ret;
  1575			/*
  1576			 * Make sure the buffer is zeroed to avoid uninitialized
  1577			 * values.
  1578			 */
> 1579			memset(gspca_dev->usb_buf, 0, sizeof(gspca_dev->usb_buf));
  1580			return;
  1581		}
  1582		if (len == 1)
  1583			gspca_dbg(gspca_dev, D_USBI, "GET 00 0000 %04x %02x\n",
  1584				  index, gspca_dev->usb_buf[0]);
  1585		else
  1586			gspca_dbg(gspca_dev, D_USBI, "GET 00 0000 %04x %02x %02x ..\n",
  1587				  index, gspca_dev->usb_buf[0],
  1588				  gspca_dev->usb_buf[1]);
  1589	}
  1590	

---
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 Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux