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:   Wed, 20 Jan 2021 08:24:40 +0800
From:   kernel test robot <lkp@...el.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Russell King <rmk+kernel@...linux.org.uk>,
        Ard Biesheuvel <ardb@...nel.org>,
        Abbott Liu <liuwenliang@...wei.com>,
        Florian Fainelli <f.fainelli@...il.com>
Subject: drivers/mtd/nand/onenand/onenand_omap2.c:385:17: sparse: sparse:
 incorrect type in argument 2 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1e2a199f6ccdc15cf111d68d212e2fd4ce65682e
commit: 421015713b306e47af95d4d61cdfbd96d462e4cb ARM: 9017/2: Enable KASan for ARM
date:   3 months ago
config: arm-randconfig-s032-20210120 (attached as .config)
compiler: arm-linux-gnueabi-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.3-208-g46a52ca4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=421015713b306e47af95d4d61cdfbd96d462e4cb
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 421015713b306e47af95d4d61cdfbd96d462e4cb
        # 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=arm 

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/mtd/nand/onenand/onenand_omap2.c:385:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *src @@     got void [noderef] __iomem * @@
   drivers/mtd/nand/onenand/onenand_omap2.c:385:17: sparse:     expected void const *src
   drivers/mtd/nand/onenand/onenand_omap2.c:385:17: sparse:     got void [noderef] __iomem *
   drivers/mtd/nand/onenand/onenand_omap2.c:404:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *src @@     got void [noderef] __iomem * @@
   drivers/mtd/nand/onenand/onenand_omap2.c:404:9: sparse:     expected void const *src
   drivers/mtd/nand/onenand/onenand_omap2.c:404:9: sparse:     got void [noderef] __iomem *
>> drivers/mtd/nand/onenand/onenand_omap2.c:444:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *dest @@     got void [noderef] __iomem * @@
   drivers/mtd/nand/onenand/onenand_omap2.c:444:9: sparse:     expected void *dest
   drivers/mtd/nand/onenand/onenand_omap2.c:444:9: sparse:     got void [noderef] __iomem *

vim +385 drivers/mtd/nand/onenand/onenand_omap2.c

3621311695f5b1a9 drivers/mtd/onenand/omap2.c      Peter Ujfalusi 2018-01-12  359  
fb25070afdf07cc6 drivers/mtd/onenand/omap2.c      Ladislav Michl 2018-01-12  360  static int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area,
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  361  					unsigned char *buffer, int offset,
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  362  					size_t count)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  363  {
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  364  	struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  365  	struct onenand_chip *this = mtd->priv;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  366  	struct device *dev = &c->pdev->dev;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  367  	void *buf = (void *)buffer;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  368  	dma_addr_t dma_src, dma_dst;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  369  	int bram_offset, err;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  370  	size_t xtra;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  371  
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  372  	bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  373  	/*
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  374  	 * If the buffer address is not DMA-able, len is not long enough to make
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  375  	 * DMA transfers profitable or panic_write() may be in an interrupt
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  376  	 * context fallback to PIO mode.
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  377  	 */
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  378  	if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  379  	    count < 384 || in_interrupt() || oops_in_progress)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  380  		goto out_copy;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  381  
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  382  	xtra = count & 3;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  383  	if (xtra) {
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  384  		count -= xtra;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06 @385  		memcpy(buf + count, this->base + bram_offset + count, xtra);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  386  	}
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  387  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  388  	dma_dst = dma_map_single(dev, buf, count, DMA_FROM_DEVICE);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  389  	dma_src = c->phys_base + bram_offset;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  390  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  391  	if (dma_mapping_error(dev, dma_dst)) {
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  392  		dev_err(dev, "Couldn't DMA map a %d byte buffer\n", count);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  393  		goto out_copy;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  394  	}
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  395  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  396  	err = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count);
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  397  	dma_unmap_single(dev, dma_dst, count, DMA_FROM_DEVICE);
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  398  	if (!err)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  399  		return 0;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  400  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  401  	dev_err(dev, "timeout waiting for DMA\n");
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  402  
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  403  out_copy:
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  404  	memcpy(buf, this->base + bram_offset, count);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  405  	return 0;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  406  }
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  407  
fb25070afdf07cc6 drivers/mtd/onenand/omap2.c      Ladislav Michl 2018-01-12  408  static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  409  					 const unsigned char *buffer,
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  410  					 int offset, size_t count)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  411  {
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  412  	struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  413  	struct onenand_chip *this = mtd->priv;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  414  	struct device *dev = &c->pdev->dev;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  415  	void *buf = (void *)buffer;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  416  	dma_addr_t dma_src, dma_dst;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  417  	int bram_offset, err;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  418  
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  419  	bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  420  	/*
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  421  	 * If the buffer address is not DMA-able, len is not long enough to make
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  422  	 * DMA transfers profitable or panic_write() may be in an interrupt
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  423  	 * context fallback to PIO mode.
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  424  	 */
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  425  	if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  426  	    count < 384 || in_interrupt() || oops_in_progress)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  427  		goto out_copy;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  428  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  429  	dma_src = dma_map_single(dev, buf, count, DMA_TO_DEVICE);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  430  	dma_dst = c->phys_base + bram_offset;
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  431  	if (dma_mapping_error(dev, dma_src)) {
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  432  		dev_err(dev, "Couldn't DMA map a %d byte buffer\n", count);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  433  		goto out_copy;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  434  	}
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  435  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  436  	err = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count);
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  437  	dma_unmap_page(dev, dma_src, count, DMA_TO_DEVICE);
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  438  	if (!err)
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  439  		return 0;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  440  
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  441  	dev_err(dev, "timeout waiting for DMA\n");
6732cfd4cac514b5 drivers/mtd/nand/onenand/omap2.c Ladislav Michl 2018-05-02  442  
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  443  out_copy:
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06 @444  	memcpy(this->base + bram_offset, buf, count);
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  445  	return 0;
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  446  }
36cd4fb5d277f34f drivers/mtd/onenand/omap2.c      Adrian Hunter  2008-08-06  447  

:::::: The code at line 385 was first introduced by commit
:::::: 36cd4fb5d277f34fe9e4db0deac2d4efd7dff735 [MTD] [OneNAND] Add OMAP2 / OMAP3 OneNAND driver

:::::: TO: Adrian Hunter <ext-adrian.hunter@...ia.com>
:::::: CC: David Woodhouse <David.Woodhouse@...el.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" (25972 bytes)

Powered by blists - more mailing lists