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, 22 Aug 2020 12:19:27 +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/net/can/cc770/cc770_isa.c:276:25: sparse: sparse: incorrect
 type in argument 1 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f873db9acd3c92d4741bc3676c9eb511b2f9a6f6
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date:   9 weeks ago
config: openrisc-randconfig-s031-20200822 (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-191-g10164920-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/net/can/cc770/cc770_isa.c:276:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem *[assigned] base @@
   drivers/net/can/cc770/cc770_isa.c:276:25: sparse:     expected void *addr
>> drivers/net/can/cc770/cc770_isa.c:276:25: sparse:     got void [noderef] __iomem *[assigned] base
>> drivers/net/can/cc770/cc770_isa.c:295:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem *reg_base @@
   drivers/net/can/cc770/cc770_isa.c:295:29: sparse:     expected void *addr
>> drivers/net/can/cc770/cc770_isa.c:295:29: sparse:     got void [noderef] __iomem *reg_base
--
>> drivers/net/can/cc770/cc770_platform.c:226:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem *[assigned] base @@
   drivers/net/can/cc770/cc770_platform.c:226:17: sparse:     expected void *addr
>> drivers/net/can/cc770/cc770_platform.c:226:17: sparse:     got void [noderef] __iomem *[assigned] base
>> drivers/net/can/cc770/cc770_platform.c:240:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem *reg_base @@
   drivers/net/can/cc770/cc770_platform.c:240:21: sparse:     expected void *addr
>> drivers/net/can/cc770/cc770_platform.c:240:21: sparse:     got void [noderef] __iomem *reg_base

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +276 drivers/net/can/cc770/cc770_isa.c

edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  160  
3c8ac0f2ad53a96 Bill Pemberton      2012-12-03  161  static int cc770_isa_probe(struct platform_device *pdev)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  162  {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  163  	struct net_device *dev;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  164  	struct cc770_priv *priv;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  165  	void __iomem *base = NULL;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  166  	int iosize = CC770_IOSIZE;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  167  	int idx = pdev->id;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  168  	int err;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  169  	u32 clktmp;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  170  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  171  	dev_dbg(&pdev->dev, "probing idx=%d: port=%#lx, mem=%#lx, irq=%d\n",
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  172  		idx, port[idx], mem[idx], irq[idx]);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  173  	if (mem[idx]) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  174  		if (!request_mem_region(mem[idx], iosize, KBUILD_MODNAME)) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  175  			err = -EBUSY;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  176  			goto exit;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  177  		}
4bdc0d676a64314 Christoph Hellwig   2020-01-06  178  		base = ioremap(mem[idx], iosize);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  179  		if (!base) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  180  			err = -ENOMEM;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  181  			goto exit_release;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  182  		}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  183  	} else {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  184  		if (indirect[idx] > 0 ||
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  185  		    (indirect[idx] == -1 && indirect[0] > 0))
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  186  			iosize = CC770_IOSIZE_INDIRECT;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  187  		if (!request_region(port[idx], iosize, KBUILD_MODNAME)) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  188  			err = -EBUSY;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  189  			goto exit;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  190  		}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  191  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  192  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  193  	dev = alloc_cc770dev(0);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  194  	if (!dev) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  195  		err = -ENOMEM;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  196  		goto exit_unmap;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  197  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  198  	priv = netdev_priv(dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  199  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  200  	dev->irq = irq[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  201  	priv->irq_flags = IRQF_SHARED;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  202  	if (mem[idx]) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  203  		priv->reg_base = base;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  204  		dev->base_addr = mem[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  205  		priv->read_reg = cc770_isa_mem_read_reg;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  206  		priv->write_reg = cc770_isa_mem_write_reg;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  207  	} else {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  208  		priv->reg_base = (void __iomem *)port[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  209  		dev->base_addr = port[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  210  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  211  		if (iosize == CC770_IOSIZE_INDIRECT) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  212  			priv->read_reg = cc770_isa_port_read_reg_indirect;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  213  			priv->write_reg = cc770_isa_port_write_reg_indirect;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  214  		} else {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  215  			priv->read_reg = cc770_isa_port_read_reg;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  216  			priv->write_reg = cc770_isa_port_write_reg;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  217  		}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  218  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  219  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  220  	if (clk[idx])
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  221  		clktmp = clk[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  222  	else if (clk[0])
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  223  		clktmp = clk[0];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  224  	else
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  225  		clktmp = CLK_DEFAULT;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  226  	priv->can.clock.freq = clktmp;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  227  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  228  	if (cir[idx] != 0xff) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  229  		priv->cpu_interface = cir[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  230  	} else if (cir[0] != 0xff) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  231  		priv->cpu_interface = cir[0];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  232  	} else {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  233  		/* The system clock may not exceed 10 MHz */
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  234  		if (clktmp > 10000000) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  235  			priv->cpu_interface |= CPUIF_DSC;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  236  			clktmp /= 2;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  237  		}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  238  		/* The memory clock may not exceed 8 MHz */
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  239  		if (clktmp > 8000000)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  240  			priv->cpu_interface |= CPUIF_DMC;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  241  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  242  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  243  	if (priv->cpu_interface & CPUIF_DSC)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  244  		priv->can.clock.freq /= 2;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  245  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  246  	if (bcr[idx] != 0xff)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  247  		priv->bus_config = bcr[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  248  	else if (bcr[0] != 0xff)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  249  		priv->bus_config = bcr[0];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  250  	else
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  251  		priv->bus_config = BCR_DEFAULT;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  252  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  253  	if (cor[idx] != 0xff)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  254  		priv->clkout = cor[idx];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  255  	else if (cor[0] != 0xff)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  256  		priv->clkout = cor[0];
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  257  	else
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  258  		priv->clkout = COR_DEFAULT;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  259  
00e4bbc8cd7efac Jingoo Han          2013-05-23  260  	platform_set_drvdata(pdev, dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  261  	SET_NETDEV_DEV(dev, &pdev->dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  262  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  263  	err = register_cc770dev(dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  264  	if (err) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  265  		dev_err(&pdev->dev,
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  266  			"couldn't register device (err=%d)\n", err);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  267  		goto exit_unmap;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  268  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  269  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  270  	dev_info(&pdev->dev, "device registered (reg_base=0x%p, irq=%d)\n",
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  271  		 priv->reg_base, dev->irq);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  272  	return 0;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  273  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  274   exit_unmap:
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  275  	if (mem[idx])
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30 @276  		iounmap(base);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  277   exit_release:
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  278  	if (mem[idx])
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  279  		release_mem_region(mem[idx], iosize);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  280  	else
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  281  		release_region(port[idx], iosize);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  282   exit:
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  283  	return err;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  284  }
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  285  
3c8ac0f2ad53a96 Bill Pemberton      2012-12-03  286  static int cc770_isa_remove(struct platform_device *pdev)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  287  {
00e4bbc8cd7efac Jingoo Han          2013-05-23  288  	struct net_device *dev = platform_get_drvdata(pdev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  289  	struct cc770_priv *priv = netdev_priv(dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  290  	int idx = pdev->id;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  291  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  292  	unregister_cc770dev(dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  293  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  294  	if (mem[idx]) {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30 @295  		iounmap(priv->reg_base);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  296  		release_mem_region(mem[idx], CC770_IOSIZE);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  297  	} else {
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  298  		if (priv->read_reg == cc770_isa_port_read_reg_indirect)
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  299  			release_region(port[idx], CC770_IOSIZE_INDIRECT);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  300  		else
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  301  			release_region(port[idx], CC770_IOSIZE);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  302  	}
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  303  	free_cc770dev(dev);
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  304  
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  305  	return 0;
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  306  }
edd2c26ffb7742b Wolfgang Grandegger 2011-11-30  307  

:::::: The code at line 276 was first introduced by commit
:::::: edd2c26ffb7742bf0d3bd324694d220281844a01 can: cc770: add legacy ISA bus driver for the CC770 and AN82527

:::::: TO: Wolfgang Grandegger <wg@...ndegger.com>
:::::: CC: David S. Miller <davem@...emloft.net>

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

Powered by blists - more mailing lists