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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat, 8 Aug 2020 11:43:50 +0800
From:   kernel test robot <lkp@...el.com>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: drivers/usb/gadget/legacy/hid.c:196:11-12: ERROR: invalid reference
 to the index variable of the iterator on line 145

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   30185b69a2d533c4ba6ca926b8390ce7de495e29
commit: df8df5e4bc37e39010cfdf5d50cf726fe08aae5b usb: get rid of 'choice' for legacy gadget drivers
date:   5 months ago
config: i386-randconfig-c003-20200807 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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


coccinelle warnings: (new ones prefixed by >>)

>> drivers/usb/gadget/legacy/hid.c:196:11-12: ERROR: invalid reference to the index variable of the iterator on line 145

vim +196 drivers/usb/gadget/legacy/hid.c

71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  130  
c94e289f195e0e drivers/usb/gadget/legacy/hid.c Arnd Bergmann             2015-04-11  131  static int hid_bind(struct usb_composite_dev *cdev)
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  132  {
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  133  	struct usb_gadget *gadget = cdev->gadget;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  134  	struct list_head *tmp;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  135  	struct hidg_func_node *n, *m;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  136  	struct f_hid_opts *hid_opts;
ed9cbda63d4563 drivers/usb/gadget/hid.c        Sebastian Andrzej Siewior 2012-09-10  137  	int status, funcs = 0;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  138  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  139  	list_for_each(tmp, &hidg_func_list)
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  140  		funcs++;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  141  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  142  	if (!funcs)
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  143  		return -ENODEV;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  144  
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06 @145  	list_for_each_entry(n, &hidg_func_list, node) {
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  146  		n->fi = usb_get_function_instance("hid");
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  147  		if (IS_ERR(n->fi)) {
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  148  			status = PTR_ERR(n->fi);
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  149  			goto put;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  150  		}
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  151  		hid_opts = container_of(n->fi, struct f_hid_opts, func_inst);
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  152  		hid_opts->subclass = n->func->subclass;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  153  		hid_opts->protocol = n->func->protocol;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  154  		hid_opts->report_length = n->func->report_length;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  155  		hid_opts->report_desc_length = n->func->report_desc_length;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  156  		hid_opts->report_desc = n->func->report_desc;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  157  	}
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  158  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  159  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  160  	/* Allocate string descriptor numbers ... note that string
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  161  	 * contents can be overridden by the composite_dev glue.
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  162  	 */
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  163  
e1f15ccbae40b5 drivers/usb/gadget/hid.c        Sebastian Andrzej Siewior 2012-09-06  164  	status = usb_string_ids_tab(cdev, strings_dev);
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  165  	if (status < 0)
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  166  		goto put;
276e2e4f1f3e07 drivers/usb/gadget/hid.c        Sebastian Andrzej Siewior 2012-09-06  167  	device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
276e2e4f1f3e07 drivers/usb/gadget/hid.c        Sebastian Andrzej Siewior 2012-09-06  168  	device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  169  
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  170  	if (gadget_is_otg(gadget) && !otg_desc[0]) {
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  171  		struct usb_descriptor_header *usb_desc;
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  172  
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  173  		usb_desc = usb_otg_descriptor_alloc(gadget);
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  174  		if (!usb_desc)
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  175  			goto put;
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  176  		usb_otg_descriptor_init(gadget, usb_desc);
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  177  		otg_desc[0] = usb_desc;
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  178  		otg_desc[1] = NULL;
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  179  	}
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  180  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  181  	/* register our configuration */
c9bfff9c98671a drivers/usb/gadget/hid.c        Uwe Kleine-K├Ânig          2010-08-12  182  	status = usb_add_config(cdev, &config_driver, do_config);
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  183  	if (status < 0)
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  184  		goto free_otg_desc;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  185  
7d16e8d3eb704f drivers/usb/gadget/hid.c        Sebastian Andrzej Siewior 2012-09-10  186  	usb_composite_overwrite_options(cdev, &coverwrite);
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  187  	dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n");
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  188  
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  189  	return 0;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  190  
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  191  free_otg_desc:
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  192  	kfree(otg_desc[0]);
d9e1867917ccf4 drivers/usb/gadget/legacy/hid.c Li Jun                    2015-07-09  193  	otg_desc[0] = NULL;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  194  put:
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  195  	list_for_each_entry(m, &hidg_func_list, node) {
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06 @196  		if (m == n)
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  197  			break;
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  198  		usb_put_function_instance(m->fi);
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  199  	}
4bc8a33f240797 drivers/usb/gadget/legacy/hid.c Andrzej Pietrasiewicz     2014-11-06  200  	return status;
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  201  }
71adf118946957 drivers/usb/gadget/hid.c        Fabien Chouteau           2010-04-08  202  

:::::: The code at line 196 was first introduced by commit
:::::: 4bc8a33f2407975a5a40bd6adf86de815d2ce913 usb: gadget: hid: convert to new interface of f_hid

:::::: TO: Andrzej Pietrasiewicz <andrzej.p@...sung.com>
:::::: CC: Felipe Balbi <balbi@...com>

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

Download attachment ".config.gz" of type "application/gzip" (28914 bytes)

Powered by blists - more mailing lists