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  linux-cve-announce  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]
Message-ID: <202008051652.ODRiqcKY%lkp@intel.com>
Date:   Wed, 5 Aug 2020 16:55:57 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/usb/host/ohci-sm501.c:177:20: sparse: sparse: incorrect type
 in argument 1 (different address spaces)

Hi Luc,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4da9f3302615f4191814f826054846bf843e24fa
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date:   7 weeks ago
config: openrisc-randconfig-s031-20200805 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-117-g8c7aee71-dirty
        git checkout 670d0a4b10704667765f7d18f7592993d02783aa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc 

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


sparse warnings: (new ones prefixed by >>)

   drivers/usb/host/ohci-hcd.c: note: in included file:
>> drivers/usb/host/ohci-sm501.c:177:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem *regs @@
   drivers/usb/host/ohci-sm501.c:177:20: sparse:     expected void *addr
>> drivers/usb/host/ohci-sm501.c:177:20: sparse:     got void [noderef] __iomem *regs
   drivers/usb/host/ohci-hcd.c: note: in included file (through arch/openrisc/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:225:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:225:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:225:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:225:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:225:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:225:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:225:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:225:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:225:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:225:22: sparse:     got restricted __le32 [usertype]

vim +177 drivers/usb/host/ohci-sm501.c

f54aab6ebcecd9 Magnus Damm     2008-01-23   87  
f54aab6ebcecd9 Magnus Damm     2008-01-23   88  static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
f54aab6ebcecd9 Magnus Damm     2008-01-23   89  {
f54aab6ebcecd9 Magnus Damm     2008-01-23   90  	const struct hc_driver *driver = &ohci_sm501_hc_driver;
f54aab6ebcecd9 Magnus Damm     2008-01-23   91  	struct device *dev = &pdev->dev;
f54aab6ebcecd9 Magnus Damm     2008-01-23   92  	struct resource	*res, *mem;
f54aab6ebcecd9 Magnus Damm     2008-01-23   93  	int retval, irq;
af3d305ca71fea Harvey Harrison 2008-04-30   94  	struct usb_hcd *hcd = NULL;
f54aab6ebcecd9 Magnus Damm     2008-01-23   95  
f54aab6ebcecd9 Magnus Damm     2008-01-23   96  	irq = retval = platform_get_irq(pdev, 0);
f54aab6ebcecd9 Magnus Damm     2008-01-23   97  	if (retval < 0)
f54aab6ebcecd9 Magnus Damm     2008-01-23   98  		goto err0;
f54aab6ebcecd9 Magnus Damm     2008-01-23   99  
f54aab6ebcecd9 Magnus Damm     2008-01-23  100  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
f54aab6ebcecd9 Magnus Damm     2008-01-23  101  	if (mem == NULL) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  102  		dev_err(dev, "no resource definition for memory\n");
f54aab6ebcecd9 Magnus Damm     2008-01-23  103  		retval = -ENOENT;
f54aab6ebcecd9 Magnus Damm     2008-01-23  104  		goto err0;
f54aab6ebcecd9 Magnus Damm     2008-01-23  105  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  106  
28f65c11f2ffb3 Joe Perches     2011-06-09  107  	if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  108  		dev_err(dev, "request_mem_region failed\n");
f54aab6ebcecd9 Magnus Damm     2008-01-23  109  		retval = -EBUSY;
f54aab6ebcecd9 Magnus Damm     2008-01-23  110  		goto err0;
f54aab6ebcecd9 Magnus Damm     2008-01-23  111  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  112  
f54aab6ebcecd9 Magnus Damm     2008-01-23  113  	/* allocate, reserve and remap resources for registers */
f54aab6ebcecd9 Magnus Damm     2008-01-23  114  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
f54aab6ebcecd9 Magnus Damm     2008-01-23  115  	if (res == NULL) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  116  		dev_err(dev, "no resource definition for registers\n");
f54aab6ebcecd9 Magnus Damm     2008-01-23  117  		retval = -ENOENT;
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  118  		goto err1;
f54aab6ebcecd9 Magnus Damm     2008-01-23  119  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  120  
7071a3ce0ca058 Kay Sievers     2008-05-02  121  	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
f54aab6ebcecd9 Magnus Damm     2008-01-23  122  	if (!hcd) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  123  		retval = -ENOMEM;
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  124  		goto err1;
f54aab6ebcecd9 Magnus Damm     2008-01-23  125  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  126  
f54aab6ebcecd9 Magnus Damm     2008-01-23  127  	hcd->rsrc_start = res->start;
28f65c11f2ffb3 Joe Perches     2011-06-09  128  	hcd->rsrc_len = resource_size(res);
f54aab6ebcecd9 Magnus Damm     2008-01-23  129  
f54aab6ebcecd9 Magnus Damm     2008-01-23  130  	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,	pdev->name)) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  131  		dev_err(dev, "request_mem_region failed\n");
f54aab6ebcecd9 Magnus Damm     2008-01-23  132  		retval = -EBUSY;
f54aab6ebcecd9 Magnus Damm     2008-01-23  133  		goto err3;
f54aab6ebcecd9 Magnus Damm     2008-01-23  134  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  135  
f54aab6ebcecd9 Magnus Damm     2008-01-23  136  	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
f54aab6ebcecd9 Magnus Damm     2008-01-23  137  	if (hcd->regs == NULL) {
f54aab6ebcecd9 Magnus Damm     2008-01-23  138  		dev_err(dev, "cannot remap registers\n");
f54aab6ebcecd9 Magnus Damm     2008-01-23  139  		retval = -ENXIO;
f54aab6ebcecd9 Magnus Damm     2008-01-23  140  		goto err4;
f54aab6ebcecd9 Magnus Damm     2008-01-23  141  	}
f54aab6ebcecd9 Magnus Damm     2008-01-23  142  
f54aab6ebcecd9 Magnus Damm     2008-01-23  143  	ohci_hcd_init(hcd_to_ohci(hcd));
f54aab6ebcecd9 Magnus Damm     2008-01-23  144  
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  145  	/* The sm501 chip is equipped with local memory that may be used
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  146  	 * by on-chip devices such as the video controller and the usb host.
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  147  	 * This driver uses genalloc so that usb allocations with
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  148  	 * gen_pool_dma_alloc() allocate from this local memory. The dma_handle
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  149  	 * returned by gen_pool_dma_alloc() will be an offset starting from 0
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  150  	 * for the first local memory byte.
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  151  	 *
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  152  	 * So as long as data is allocated using gen_pool_dma_alloc() all is
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  153  	 * fine. This is however not always the case - buffers may be allocated
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  154  	 * using kmalloc() - so the usb core needs to be told that it must copy
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  155  	 * data into our local memory if the buffers happen to be placed in
2d7a3dc3e24f43 Laurentiu Tudor 2019-05-29  156  	 * regular memory. A non-null hcd->localmem_pool initialized by the
2d7a3dc3e24f43 Laurentiu Tudor 2019-05-29  157  	 * the call to usb_hcd_setup_local_mem() below does just that.
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  158  	 */
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  159  
b919e077cccfbb Wei Yongjun     2020-05-06  160  	retval = usb_hcd_setup_local_mem(hcd, mem->start,
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  161  					 mem->start - mem->parent->start,
b919e077cccfbb Wei Yongjun     2020-05-06  162  					 resource_size(mem));
b919e077cccfbb Wei Yongjun     2020-05-06  163  	if (retval < 0)
7d9e6f5aebe8c0 Laurentiu Tudor 2019-05-29  164  		goto err5;
b5dd18d8747010 Yong Zhang      2011-09-07  165  	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
f54aab6ebcecd9 Magnus Damm     2008-01-23  166  	if (retval)
637ed74ff9e86d Dan Carpenter   2010-09-10  167  		goto err5;
3c9740a117d40a Peter Chen      2013-11-05  168  	device_wakeup_enable(hcd->self.controller);
f54aab6ebcecd9 Magnus Damm     2008-01-23  169  
f54aab6ebcecd9 Magnus Damm     2008-01-23  170  	/* enable power and unmask interrupts */
f54aab6ebcecd9 Magnus Damm     2008-01-23  171  
f54aab6ebcecd9 Magnus Damm     2008-01-23  172  	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1);
f54aab6ebcecd9 Magnus Damm     2008-01-23  173  	sm501_modify_reg(dev->parent, SM501_IRQ_MASK, 1 << 6, 0);
f54aab6ebcecd9 Magnus Damm     2008-01-23  174  
f54aab6ebcecd9 Magnus Damm     2008-01-23  175  	return 0;
637ed74ff9e86d Dan Carpenter   2010-09-10  176  err5:
637ed74ff9e86d Dan Carpenter   2010-09-10 @177  	iounmap(hcd->regs);
f54aab6ebcecd9 Magnus Damm     2008-01-23  178  err4:
f54aab6ebcecd9 Magnus Damm     2008-01-23  179  	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
f54aab6ebcecd9 Magnus Damm     2008-01-23  180  err3:
f54aab6ebcecd9 Magnus Damm     2008-01-23  181  	usb_put_hcd(hcd);
f54aab6ebcecd9 Magnus Damm     2008-01-23  182  err1:
28f65c11f2ffb3 Joe Perches     2011-06-09  183  	release_mem_region(mem->start, resource_size(mem));
f54aab6ebcecd9 Magnus Damm     2008-01-23  184  err0:
f54aab6ebcecd9 Magnus Damm     2008-01-23  185  	return retval;
f54aab6ebcecd9 Magnus Damm     2008-01-23  186  }
f54aab6ebcecd9 Magnus Damm     2008-01-23  187  

:::::: The code at line 177 was first introduced by commit
:::::: 637ed74ff9e86d8c2979e430309a1fd28c921de9 USB: ohci-sm501: add iounmap on error path

:::::: TO: Dan Carpenter <error27@...il.com>
:::::: CC: Greg Kroah-Hartman <gregkh@...e.de>

---
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" (20162 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ