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: <202010290733.VhRpOMqe-lkp@intel.com>
Date:   Thu, 29 Oct 2020 07:11:36 +0800
From:   kernel test robot <lkp@...el.com>
To:     Will Deacon <will@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/dma/mediatek/mtk-hsdma.c:451:17: sparse: sparse: incorrect
 type in assignment (different base types)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   23859ae44402f4d935b9ee548135dd1e65e2cbf4
commit: a5460b5e5fb82656807840d40d3deaecad094044 READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()
date:   7 months ago
config: xtensa-randconfig-s031-20201029 (attached as .config)
compiler: xtensa-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.3-56-gc09e8239-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5460b5e5fb82656807840d40d3deaecad094044
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a5460b5e5fb82656807840d40d3deaecad094044
        # 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=xtensa 

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/dma/mediatek/mtk-hsdma.c:451:17: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 volatile @@     got unsigned int [usertype] src @@
   drivers/dma/mediatek/mtk-hsdma.c:451:17: sparse:     expected restricted __le32 volatile
>> drivers/dma/mediatek/mtk-hsdma.c:451:17: sparse:     got unsigned int [usertype] src
   drivers/dma/mediatek/mtk-hsdma.c:452:17: sparse: sparse: restricted __le32 degrades to integer
   drivers/dma/mediatek/mtk-hsdma.c:452:17: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 volatile @@     got unsigned int @@
   drivers/dma/mediatek/mtk-hsdma.c:452:17: sparse:     expected restricted __le32 volatile
   drivers/dma/mediatek/mtk-hsdma.c:452:17: sparse:     got unsigned int
>> drivers/dma/mediatek/mtk-hsdma.c:456:17: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 volatile @@     got unsigned int [usertype] dest @@
   drivers/dma/mediatek/mtk-hsdma.c:456:17: sparse:     expected restricted __le32 volatile
>> drivers/dma/mediatek/mtk-hsdma.c:456:17: sparse:     got unsigned int [usertype] dest
   drivers/dma/mediatek/mtk-hsdma.c:457:17: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 volatile @@     got int @@
   drivers/dma/mediatek/mtk-hsdma.c:457:17: sparse:     expected restricted __le32 volatile
   drivers/dma/mediatek/mtk-hsdma.c:457:17: sparse:     got int
   drivers/dma/mediatek/mtk-hsdma.c:580:33: sparse: sparse: restricted __le32 degrades to integer
   drivers/dma/mediatek/mtk-hsdma.c:604:26: sparse: sparse: Using plain integer as NULL pointer
   drivers/dma/mediatek/mtk-hsdma.c:878:18: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le32 [usertype] ddone @@     got unsigned long @@
   drivers/dma/mediatek/mtk-hsdma.c:878:18: sparse:     expected restricted __le32 [usertype] ddone
   drivers/dma/mediatek/mtk-hsdma.c:878:18: sparse:     got unsigned long
   drivers/dma/mediatek/mtk-hsdma.c:879:16: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le32 [usertype] ls0 @@     got unsigned long @@
   drivers/dma/mediatek/mtk-hsdma.c:879:16: sparse:     expected restricted __le32 [usertype] ls0
   drivers/dma/mediatek/mtk-hsdma.c:879:16: sparse:     got unsigned long
   drivers/dma/mediatek/mtk-hsdma.c:883:18: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le32 [usertype] ddone @@     got unsigned long @@
   drivers/dma/mediatek/mtk-hsdma.c:883:18: sparse:     expected restricted __le32 [usertype] ddone
   drivers/dma/mediatek/mtk-hsdma.c:883:18: sparse:     got unsigned long
   drivers/dma/mediatek/mtk-hsdma.c:884:16: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le32 [usertype] ls0 @@     got unsigned long @@
   drivers/dma/mediatek/mtk-hsdma.c:884:16: sparse:     expected restricted __le32 [usertype] ls0
   drivers/dma/mediatek/mtk-hsdma.c:884:16: sparse:     got unsigned long
   drivers/dma/mediatek/mtk-hsdma.c: note: in included file (through arch/xtensa/include/asm/io.h, include/linux/scatterlist.h, include/linux/dmaengine.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

vim +451 drivers/dma/mediatek/mtk-hsdma.c

548c4597e984b7 Sean Wang 2018-03-15  411  
548c4597e984b7 Sean Wang 2018-03-15  412  static int mtk_hsdma_issue_pending_vdesc(struct mtk_hsdma_device *hsdma,
548c4597e984b7 Sean Wang 2018-03-15  413  					 struct mtk_hsdma_pchan *pc,
548c4597e984b7 Sean Wang 2018-03-15  414  					 struct mtk_hsdma_vdesc *hvd)
548c4597e984b7 Sean Wang 2018-03-15  415  {
548c4597e984b7 Sean Wang 2018-03-15  416  	struct mtk_hsdma_ring *ring = &pc->ring;
548c4597e984b7 Sean Wang 2018-03-15  417  	struct mtk_hsdma_pdesc *txd, *rxd;
548c4597e984b7 Sean Wang 2018-03-15  418  	u16 reserved, prev, tlen, num_sgs;
548c4597e984b7 Sean Wang 2018-03-15  419  	unsigned long flags;
548c4597e984b7 Sean Wang 2018-03-15  420  
548c4597e984b7 Sean Wang 2018-03-15  421  	/* Protect against PC is accessed by multiple VCs simultaneously */
548c4597e984b7 Sean Wang 2018-03-15  422  	spin_lock_irqsave(&hsdma->lock, flags);
548c4597e984b7 Sean Wang 2018-03-15  423  
548c4597e984b7 Sean Wang 2018-03-15  424  	/*
548c4597e984b7 Sean Wang 2018-03-15  425  	 * Reserve rooms, where pc->nr_free is used to track how many free
548c4597e984b7 Sean Wang 2018-03-15  426  	 * rooms in the ring being updated in user and IRQ context.
548c4597e984b7 Sean Wang 2018-03-15  427  	 */
548c4597e984b7 Sean Wang 2018-03-15  428  	num_sgs = DIV_ROUND_UP(hvd->len, MTK_HSDMA_MAX_LEN);
548c4597e984b7 Sean Wang 2018-03-15  429  	reserved = min_t(u16, num_sgs, atomic_read(&pc->nr_free));
548c4597e984b7 Sean Wang 2018-03-15  430  
548c4597e984b7 Sean Wang 2018-03-15  431  	if (!reserved) {
548c4597e984b7 Sean Wang 2018-03-15  432  		spin_unlock_irqrestore(&hsdma->lock, flags);
548c4597e984b7 Sean Wang 2018-03-15  433  		return -ENOSPC;
548c4597e984b7 Sean Wang 2018-03-15  434  	}
548c4597e984b7 Sean Wang 2018-03-15  435  
548c4597e984b7 Sean Wang 2018-03-15  436  	atomic_sub(reserved, &pc->nr_free);
548c4597e984b7 Sean Wang 2018-03-15  437  
548c4597e984b7 Sean Wang 2018-03-15  438  	while (reserved--) {
548c4597e984b7 Sean Wang 2018-03-15  439  		/* Limit size by PD capability for valid data moving */
548c4597e984b7 Sean Wang 2018-03-15  440  		tlen = (hvd->len > MTK_HSDMA_MAX_LEN) ?
548c4597e984b7 Sean Wang 2018-03-15  441  		       MTK_HSDMA_MAX_LEN : hvd->len;
548c4597e984b7 Sean Wang 2018-03-15  442  
548c4597e984b7 Sean Wang 2018-03-15  443  		/*
548c4597e984b7 Sean Wang 2018-03-15  444  		 * Setup PDs using the remaining VD info mapped on those
548c4597e984b7 Sean Wang 2018-03-15  445  		 * reserved rooms. And since RXD is shared memory between the
548c4597e984b7 Sean Wang 2018-03-15  446  		 * host and the device allocated by dma_alloc_coherent call,
548c4597e984b7 Sean Wang 2018-03-15  447  		 * the helper macro WRITE_ONCE can ensure the data written to
548c4597e984b7 Sean Wang 2018-03-15  448  		 * RAM would really happens.
548c4597e984b7 Sean Wang 2018-03-15  449  		 */
548c4597e984b7 Sean Wang 2018-03-15  450  		txd = &ring->txd[ring->cur_tptr];
548c4597e984b7 Sean Wang 2018-03-15 @451  		WRITE_ONCE(txd->desc1, hvd->src);
548c4597e984b7 Sean Wang 2018-03-15  452  		WRITE_ONCE(txd->desc2,
548c4597e984b7 Sean Wang 2018-03-15  453  			   hsdma->soc->ls0 | MTK_HSDMA_DESC_PLEN(tlen));
548c4597e984b7 Sean Wang 2018-03-15  454  
548c4597e984b7 Sean Wang 2018-03-15  455  		rxd = &ring->rxd[ring->cur_tptr];
548c4597e984b7 Sean Wang 2018-03-15 @456  		WRITE_ONCE(rxd->desc1, hvd->dest);
548c4597e984b7 Sean Wang 2018-03-15  457  		WRITE_ONCE(rxd->desc2, MTK_HSDMA_DESC_PLEN(tlen));
548c4597e984b7 Sean Wang 2018-03-15  458  
548c4597e984b7 Sean Wang 2018-03-15  459  		/* Associate VD, the PD belonged to */
548c4597e984b7 Sean Wang 2018-03-15  460  		ring->cb[ring->cur_tptr].vd = &hvd->vd;
548c4597e984b7 Sean Wang 2018-03-15  461  
548c4597e984b7 Sean Wang 2018-03-15  462  		/* Move forward the pointer of TX ring */
548c4597e984b7 Sean Wang 2018-03-15  463  		ring->cur_tptr = MTK_HSDMA_NEXT_DESP_IDX(ring->cur_tptr,
548c4597e984b7 Sean Wang 2018-03-15  464  							 MTK_DMA_SIZE);
548c4597e984b7 Sean Wang 2018-03-15  465  
548c4597e984b7 Sean Wang 2018-03-15  466  		/* Update VD with remaining data */
548c4597e984b7 Sean Wang 2018-03-15  467  		hvd->src  += tlen;
548c4597e984b7 Sean Wang 2018-03-15  468  		hvd->dest += tlen;
548c4597e984b7 Sean Wang 2018-03-15  469  		hvd->len  -= tlen;
548c4597e984b7 Sean Wang 2018-03-15  470  	}
548c4597e984b7 Sean Wang 2018-03-15  471  
548c4597e984b7 Sean Wang 2018-03-15  472  	/*
548c4597e984b7 Sean Wang 2018-03-15  473  	 * Tagging flag for the last PD for VD will be responsible for
548c4597e984b7 Sean Wang 2018-03-15  474  	 * completing VD.
548c4597e984b7 Sean Wang 2018-03-15  475  	 */
548c4597e984b7 Sean Wang 2018-03-15  476  	if (!hvd->len) {
548c4597e984b7 Sean Wang 2018-03-15  477  		prev = MTK_HSDMA_LAST_DESP_IDX(ring->cur_tptr, MTK_DMA_SIZE);
548c4597e984b7 Sean Wang 2018-03-15  478  		ring->cb[prev].flag = MTK_HSDMA_VDESC_FINISHED;
548c4597e984b7 Sean Wang 2018-03-15  479  	}
548c4597e984b7 Sean Wang 2018-03-15  480  
548c4597e984b7 Sean Wang 2018-03-15  481  	/* Ensure all changes indeed done before we're going on */
548c4597e984b7 Sean Wang 2018-03-15  482  	wmb();
548c4597e984b7 Sean Wang 2018-03-15  483  
548c4597e984b7 Sean Wang 2018-03-15  484  	/*
548c4597e984b7 Sean Wang 2018-03-15  485  	 * Updating into hardware the pointer of TX ring lets HSDMA to take
548c4597e984b7 Sean Wang 2018-03-15  486  	 * action for those pending PDs.
548c4597e984b7 Sean Wang 2018-03-15  487  	 */
548c4597e984b7 Sean Wang 2018-03-15  488  	mtk_dma_write(hsdma, MTK_HSDMA_TX_CPU, ring->cur_tptr);
548c4597e984b7 Sean Wang 2018-03-15  489  
548c4597e984b7 Sean Wang 2018-03-15  490  	spin_unlock_irqrestore(&hsdma->lock, flags);
548c4597e984b7 Sean Wang 2018-03-15  491  
548c4597e984b7 Sean Wang 2018-03-15  492  	return 0;
548c4597e984b7 Sean Wang 2018-03-15  493  }
548c4597e984b7 Sean Wang 2018-03-15  494  

:::::: The code at line 451 was first introduced by commit
:::::: 548c4597e984b79aad8190235d664f1c3a433f94 dmaengine: mediatek: Add MediaTek High-Speed DMA controller for MT7622 and MT7623 SoC

:::::: TO: Sean Wang <sean.wang@...iatek.com>
:::::: CC: Vinod Koul <vinod.koul@...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" (31139 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ