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: <202005280528.DKmAsIF9%lkp@intel.com>
Date:   Thu, 28 May 2020 05:13:31 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Baolin Wang <baolin.wang7@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Bjorn Andersson <bjorn.andersson@...aro.org>
Subject: drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: sparse:
 incorrect type in initializer (different address spaces)

Hi Baolin,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b0c3ba31be3e45a130e13b278cf3b90f69bda6f6
commit: ffd0bbfb378ecd56eac22bf932ccdbf89ac7f725 hwspinlock: Allow drivers to be built with COMPILE_TEST
date:   9 weeks ago
config: mips-randconfig-s032-20200527 (attached as .config)
compiler: mips64-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-240-gf0fe1cd9-dirty
        git checkout ffd0bbfb378ecd56eac22bf932ccdbf89ac7f725
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=mips CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] <asn:2> *lock_addr @@     got void *priv @@
   drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse:     expected void [noderef] <asn:2> *lock_addr
   drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse:     got void *priv
   drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] <asn:2> *lock_addr @@     got void *priv @@
   drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse:     expected void [noderef] <asn:2> *lock_addr
   drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse:     got void *priv
>> drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *priv @@     got void [noderef] <asn:2> * @@
   drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse:     expected void *priv
   drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse:     got void [noderef] <asn:2> *
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
--
>> drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] <asn:2> *lock_addr @@     got void *priv @@
   drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse:     expected void [noderef] <asn:2> *lock_addr
   drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse:     got void *priv
   drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] <asn:2> *lock_addr @@     got void *priv @@
   drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse:     expected void [noderef] <asn:2> *lock_addr
   drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse:     got void *priv
>> drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *priv @@     got void [noderef] <asn:2> * @@
   drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse:     expected void *priv
   drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse:     got void [noderef] <asn:2> *
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
   arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32

vim +30 drivers/hwspinlock/stm32_hwspinlock.c

f24fcff1d267da Benjamin Gaignard 2018-11-14  27  
f24fcff1d267da Benjamin Gaignard 2018-11-14  28  static int stm32_hwspinlock_trylock(struct hwspinlock *lock)
f24fcff1d267da Benjamin Gaignard 2018-11-14  29  {
f24fcff1d267da Benjamin Gaignard 2018-11-14 @30  	void __iomem *lock_addr = lock->priv;
f24fcff1d267da Benjamin Gaignard 2018-11-14  31  	u32 status;
f24fcff1d267da Benjamin Gaignard 2018-11-14  32  
f24fcff1d267da Benjamin Gaignard 2018-11-14  33  	writel(STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID, lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14  34  	status = readl(lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14  35  
f24fcff1d267da Benjamin Gaignard 2018-11-14  36  	return status == (STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID);
f24fcff1d267da Benjamin Gaignard 2018-11-14  37  }
f24fcff1d267da Benjamin Gaignard 2018-11-14  38  
f24fcff1d267da Benjamin Gaignard 2018-11-14  39  static void stm32_hwspinlock_unlock(struct hwspinlock *lock)
f24fcff1d267da Benjamin Gaignard 2018-11-14  40  {
f24fcff1d267da Benjamin Gaignard 2018-11-14  41  	void __iomem *lock_addr = lock->priv;
f24fcff1d267da Benjamin Gaignard 2018-11-14  42  
f24fcff1d267da Benjamin Gaignard 2018-11-14  43  	writel(STM32_MUTEX_COREID, lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14  44  }
f24fcff1d267da Benjamin Gaignard 2018-11-14  45  
5cd69f13deef80 Fabien Dessenne   2019-03-07  46  static void stm32_hwspinlock_relax(struct hwspinlock *lock)
5cd69f13deef80 Fabien Dessenne   2019-03-07  47  {
5cd69f13deef80 Fabien Dessenne   2019-03-07  48  	ndelay(50);
5cd69f13deef80 Fabien Dessenne   2019-03-07  49  }
5cd69f13deef80 Fabien Dessenne   2019-03-07  50  
f24fcff1d267da Benjamin Gaignard 2018-11-14  51  static const struct hwspinlock_ops stm32_hwspinlock_ops = {
f24fcff1d267da Benjamin Gaignard 2018-11-14  52  	.trylock	= stm32_hwspinlock_trylock,
f24fcff1d267da Benjamin Gaignard 2018-11-14  53  	.unlock		= stm32_hwspinlock_unlock,
5cd69f13deef80 Fabien Dessenne   2019-03-07  54  	.relax		= stm32_hwspinlock_relax,
f24fcff1d267da Benjamin Gaignard 2018-11-14  55  };
f24fcff1d267da Benjamin Gaignard 2018-11-14  56  
f24fcff1d267da Benjamin Gaignard 2018-11-14  57  static int stm32_hwspinlock_probe(struct platform_device *pdev)
f24fcff1d267da Benjamin Gaignard 2018-11-14  58  {
f24fcff1d267da Benjamin Gaignard 2018-11-14  59  	struct stm32_hwspinlock *hw;
f24fcff1d267da Benjamin Gaignard 2018-11-14  60  	void __iomem *io_base;
f24fcff1d267da Benjamin Gaignard 2018-11-14  61  	size_t array_size;
f24fcff1d267da Benjamin Gaignard 2018-11-14  62  	int i, ret;
f24fcff1d267da Benjamin Gaignard 2018-11-14  63  
d4824486b676ef Yangtao Li        2019-12-28  64  	io_base = devm_platform_ioremap_resource(pdev, 0);
4d5a91fd1f42a8 Wei Yongjun       2019-01-03  65  	if (IS_ERR(io_base))
4d5a91fd1f42a8 Wei Yongjun       2019-01-03  66  		return PTR_ERR(io_base);
f24fcff1d267da Benjamin Gaignard 2018-11-14  67  
f24fcff1d267da Benjamin Gaignard 2018-11-14  68  	array_size = STM32_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
f24fcff1d267da Benjamin Gaignard 2018-11-14  69  	hw = devm_kzalloc(&pdev->dev, sizeof(*hw) + array_size, GFP_KERNEL);
f24fcff1d267da Benjamin Gaignard 2018-11-14  70  	if (!hw)
f24fcff1d267da Benjamin Gaignard 2018-11-14  71  		return -ENOMEM;
f24fcff1d267da Benjamin Gaignard 2018-11-14  72  
f24fcff1d267da Benjamin Gaignard 2018-11-14  73  	hw->clk = devm_clk_get(&pdev->dev, "hsem");
f24fcff1d267da Benjamin Gaignard 2018-11-14  74  	if (IS_ERR(hw->clk))
f24fcff1d267da Benjamin Gaignard 2018-11-14  75  		return PTR_ERR(hw->clk);
f24fcff1d267da Benjamin Gaignard 2018-11-14  76  
f24fcff1d267da Benjamin Gaignard 2018-11-14  77  	for (i = 0; i < STM32_MUTEX_NUM_LOCKS; i++)
f24fcff1d267da Benjamin Gaignard 2018-11-14 @78  		hw->bank.lock[i].priv = io_base + i * sizeof(u32);
f24fcff1d267da Benjamin Gaignard 2018-11-14  79  
f24fcff1d267da Benjamin Gaignard 2018-11-14  80  	platform_set_drvdata(pdev, hw);
f24fcff1d267da Benjamin Gaignard 2018-11-14  81  	pm_runtime_enable(&pdev->dev);
f24fcff1d267da Benjamin Gaignard 2018-11-14  82  
f24fcff1d267da Benjamin Gaignard 2018-11-14  83  	ret = hwspin_lock_register(&hw->bank, &pdev->dev, &stm32_hwspinlock_ops,
f24fcff1d267da Benjamin Gaignard 2018-11-14  84  				   0, STM32_MUTEX_NUM_LOCKS);
f24fcff1d267da Benjamin Gaignard 2018-11-14  85  
f24fcff1d267da Benjamin Gaignard 2018-11-14  86  	if (ret)
f24fcff1d267da Benjamin Gaignard 2018-11-14  87  		pm_runtime_disable(&pdev->dev);
f24fcff1d267da Benjamin Gaignard 2018-11-14  88  
f24fcff1d267da Benjamin Gaignard 2018-11-14  89  	return ret;
f24fcff1d267da Benjamin Gaignard 2018-11-14  90  }
f24fcff1d267da Benjamin Gaignard 2018-11-14  91  

:::::: The code at line 30 was first introduced by commit
:::::: f24fcff1d267da08c4bbb3869e7f4b36ce916b76 hwspinlock: add STM32 hwspinlock device

:::::: TO: Benjamin Gaignard <benjamin.gaignard@...com>
:::::: CC: Bjorn Andersson <bjorn.andersson@...aro.org>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ