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: <202210021528.ZJNSBEMq-lkp@intel.com>
Date:   Sun, 2 Oct 2022 15:31:15 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: arch/arm/mach-mvebu/pmsu.c:145:9: 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:   b357fd1c2afc1a3e1b73dc4574bb7ac0e3bd4193
commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
date:   8 months ago
config: arm-randconfig-s031-20221002
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.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.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f68f2ff91512c199ec24883001245912afc17873
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout f68f2ff91512c199ec24883001245912afc17873
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash

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

sparse warnings: (new ones prefixed by >>)
>> arch/arm/mach-mvebu/pmsu.c:145:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem *[assigned] sram_virt_base @@
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     expected void const *
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     got void [noderef] __iomem *[assigned] sram_virt_base
>> arch/arm/mach-mvebu/pmsu.c:145:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem *[assigned] sram_virt_base @@
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     expected void const *
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     got void [noderef] __iomem *[assigned] sram_virt_base
>> arch/arm/mach-mvebu/pmsu.c:145:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void * @@     got void [noderef] __iomem *[assigned] sram_virt_base @@
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     expected void *
   arch/arm/mach-mvebu/pmsu.c:145:9: sparse:     got void [noderef] __iomem *[assigned] sram_virt_base
--
   arch/arm/mach-imx/pm-imx5.c:244:17: sparse: sparse: restricted suspend_state_t degrades to integer
   arch/arm/mach-imx/pm-imx5.c:244:25: sparse: sparse: restricted suspend_state_t degrades to integer
   arch/arm/mach-imx/pm-imx5.c:244:42: sparse: sparse: restricted suspend_state_t degrades to integer
   arch/arm/mach-imx/pm-imx5.c:244:51: sparse: sparse: restricted suspend_state_t degrades to integer
   arch/arm/mach-imx/pm-imx5.c:342:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct imx5_cpu_suspend_info *suspend_info @@     got void [noderef] __iomem *static [addressable] [toplevel] suspend_ocram_base @@
   arch/arm/mach-imx/pm-imx5.c:342:22: sparse:     expected struct imx5_cpu_suspend_info *suspend_info
   arch/arm/mach-imx/pm-imx5.c:342:22: sparse:     got void [noderef] __iomem *static [addressable] [toplevel] suspend_ocram_base
>> arch/arm/mach-imx/pm-imx5.c:360:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     expected void const *
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-imx/pm-imx5.c:360:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     expected void const *
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-imx/pm-imx5.c:360:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     expected void *
   arch/arm/mach-imx/pm-imx5.c:360:36: sparse:     got void [noderef] __iomem *
--
   arch/arm/mach-imx/pm-imx6.c:373:24: sparse: sparse: cast removes address space '__iomem' of expression
   arch/arm/mach-imx/pm-imx6.c:513:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *p @@     got void [noderef] __iomem *static [assigned] [toplevel] suspend_ocram_base @@
   arch/arm/mach-imx/pm-imx6.c:513:16: sparse:     expected void *p
   arch/arm/mach-imx/pm-imx6.c:513:16: sparse:     got void [noderef] __iomem *static [assigned] [toplevel] suspend_ocram_base
   arch/arm/mach-imx/pm-imx6.c:514:17: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct imx6_cpu_pm_info *pm_info @@     got void [noderef] __iomem *static [assigned] [toplevel] suspend_ocram_base @@
   arch/arm/mach-imx/pm-imx6.c:514:17: sparse:     expected struct imx6_cpu_pm_info *pm_info
   arch/arm/mach-imx/pm-imx6.c:514:17: sparse:     got void [noderef] __iomem *static [assigned] [toplevel] suspend_ocram_base
>> arch/arm/mach-imx/pm-imx6.c:570:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     expected void const *
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-imx/pm-imx6.c:570:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     expected void const *
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-imx/pm-imx6.c:570:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     expected void *
   arch/arm/mach-imx/pm-imx6.c:570:36: sparse:     got void [noderef] __iomem *
--
   arch/arm/mach-tegra/pm.c:116:27: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int [usertype] *cpu_in_lp2 @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:116:27: sparse:     expected unsigned int [usertype] *cpu_in_lp2
   arch/arm/mach-tegra/pm.c:116:27: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:129:27: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int [usertype] *cpu_in_lp2 @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:129:27: sparse:     expected unsigned int [usertype] *cpu_in_lp2
   arch/arm/mach-tegra/pm.c:129:27: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-tegra/pm.c:322:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:322:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:322:9: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-tegra/pm.c:322:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:322:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:322:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:322:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:322:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:322:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:324:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:324:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:324:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:324:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:324:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:324:9: sparse:     got void [noderef] __iomem *
>> arch/arm/mach-tegra/pm.c:324:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:324:9: sparse:     expected void *
   arch/arm/mach-tegra/pm.c:324:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:327:12: sparse: sparse: cast removes address space '__iomem' of expression
   arch/arm/mach-tegra/pm.c:333:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:333:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:333:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:333:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:333:9: sparse:     expected void const *
   arch/arm/mach-tegra/pm.c:333:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:333:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
   arch/arm/mach-tegra/pm.c:333:9: sparse:     expected void *
   arch/arm/mach-tegra/pm.c:333:9: sparse:     got void [noderef] __iomem *
   arch/arm/mach-tegra/pm.c:336:11: sparse: sparse: cast removes address space '__iomem' of expression
--
   arch/arm/mach-tegra/reset.c:64:9: sparse: sparse: subtraction of functions? Share your drugs
   arch/arm/mach-tegra/reset.c:66:9: sparse: sparse: subtraction of functions? Share your drugs
>> arch/arm/mach-tegra/reset.c:66:9: sparse: sparse: cast from unknown type

vim +145 arch/arm/mach-mvebu/pmsu.c

3076cc58c95809 Gregory CLEMENT 2014-07-23  121  
3076cc58c95809 Gregory CLEMENT 2014-07-23  122  /*
3076cc58c95809 Gregory CLEMENT 2014-07-23  123   * This function sets up the boot address workaround needed for SMP
3076cc58c95809 Gregory CLEMENT 2014-07-23  124   * boot on Armada 375 Z1 and cpuidle on Armada 370. It unmaps the
3076cc58c95809 Gregory CLEMENT 2014-07-23  125   * BootROM Mbus window, and instead remaps a crypto SRAM into which a
3076cc58c95809 Gregory CLEMENT 2014-07-23  126   * custom piece of code is copied to replace the problematic BootROM.
3076cc58c95809 Gregory CLEMENT 2014-07-23  127   */
3076cc58c95809 Gregory CLEMENT 2014-07-23  128  int mvebu_setup_boot_addr_wa(unsigned int crypto_eng_target,
3076cc58c95809 Gregory CLEMENT 2014-07-23  129  			     unsigned int crypto_eng_attribute,
3076cc58c95809 Gregory CLEMENT 2014-07-23  130  			     phys_addr_t resume_addr_reg)
3076cc58c95809 Gregory CLEMENT 2014-07-23  131  {
3076cc58c95809 Gregory CLEMENT 2014-07-23  132  	void __iomem *sram_virt_base;
d0d378ff451a66 Ethan Tuttle    2018-06-19  133  	u32 code_len = mvebu_boot_wa_end - mvebu_boot_wa_start;
3076cc58c95809 Gregory CLEMENT 2014-07-23  134  
3076cc58c95809 Gregory CLEMENT 2014-07-23  135  	mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
3076cc58c95809 Gregory CLEMENT 2014-07-23  136  	mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute,
3076cc58c95809 Gregory CLEMENT 2014-07-23  137  				    SRAM_PHYS_BASE, SZ_64K);
3076cc58c95809 Gregory CLEMENT 2014-07-23  138  
3076cc58c95809 Gregory CLEMENT 2014-07-23  139  	sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K);
3076cc58c95809 Gregory CLEMENT 2014-07-23  140  	if (!sram_virt_base) {
3076cc58c95809 Gregory CLEMENT 2014-07-23  141  		pr_err("Unable to map SRAM to setup the boot address WA\n");
3076cc58c95809 Gregory CLEMENT 2014-07-23  142  		return -ENOMEM;
3076cc58c95809 Gregory CLEMENT 2014-07-23  143  	}
3076cc58c95809 Gregory CLEMENT 2014-07-23  144  
3076cc58c95809 Gregory CLEMENT 2014-07-23 @145  	memcpy(sram_virt_base, &mvebu_boot_wa_start, code_len);
3076cc58c95809 Gregory CLEMENT 2014-07-23  146  
3076cc58c95809 Gregory CLEMENT 2014-07-23  147  	/*
3076cc58c95809 Gregory CLEMENT 2014-07-23  148  	 * The last word of the code copied in SRAM must contain the
3076cc58c95809 Gregory CLEMENT 2014-07-23  149  	 * physical base address of the PMSU register. We
3076cc58c95809 Gregory CLEMENT 2014-07-23  150  	 * intentionally store this address in the native endianness
3076cc58c95809 Gregory CLEMENT 2014-07-23  151  	 * of the system.
3076cc58c95809 Gregory CLEMENT 2014-07-23  152  	 */
3076cc58c95809 Gregory CLEMENT 2014-07-23  153  	__raw_writel((unsigned long)resume_addr_reg,
3076cc58c95809 Gregory CLEMENT 2014-07-23  154  		     sram_virt_base + code_len - 4);
3076cc58c95809 Gregory CLEMENT 2014-07-23  155  
3076cc58c95809 Gregory CLEMENT 2014-07-23  156  	iounmap(sram_virt_base);
3076cc58c95809 Gregory CLEMENT 2014-07-23  157  
3076cc58c95809 Gregory CLEMENT 2014-07-23  158  	return 0;
3076cc58c95809 Gregory CLEMENT 2014-07-23  159  }
3076cc58c95809 Gregory CLEMENT 2014-07-23  160  

:::::: The code at line 145 was first introduced by commit
:::::: 3076cc58c958090ad50acf50fc855845e3462523 ARM: mvebu: add a common function for the boot address work around

:::::: TO: Gregory CLEMENT <gregory.clement@...e-electrons.com>
:::::: CC: Jason Cooper <jason@...edaemon.net>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (175014 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ