arch/x86/kernel/eisa.c:20:24: sparse: sparse: incorrect type in argument 1 (different address spaces)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/cleanups head: cc5e03f3be3154f860c9d08b2ac8c139863e1515 commit: 80a4da05642c384bc6f5b602b865ebd7e3963902 [3/9] x86/EISA: Use memremap() to probe for the EISA BIOS signature config: i386-randconfig-061-20240826 (https://download.01.org/0day-ci/archive/20240826/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240826/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/eisa.c:20:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void *[assigned] p @@
arch/x86/kernel/eisa.c:20:24: sparse: expected void const volatile [noderef] __iomem *addr
arch/x86/kernel/eisa.c:20:24: sparse: got void *[assigned] p
vim +20 arch/x86/kernel/eisa.c
6a92b11169a65b Boris Ostrovsky 2018-09-11 11
f7eaf6e00fd581 Thomas Gleixner 2017-08-28 12 static __init int eisa_bus_probe(void)
f7eaf6e00fd581 Thomas Gleixner 2017-08-28 13 {
80a4da05642c38 Maciej W. Rozycki 2024-08-24 14 void *p;
6a92b11169a65b Boris Ostrovsky 2018-09-11 15
0f4a1e80989aca Kevin Loughlin 2024-03-13 16 if ((xen_pv_domain() && !xen_initial_domain()) || cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
6a92b11169a65b Boris Ostrovsky 2018-09-11 17 return 0;
f7eaf6e00fd581 Thomas Gleixner 2017-08-28 18
80a4da05642c38 Maciej W. Rozycki 2024-08-24 19 p = memremap(0x0FFFD9, 4, MEMREMAP_WB);6a92b11169a65b Boris Ostrovsky 2018-09-11 @20 if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
:::::: The code at line 20 was first introduced by commit
:::::: 6a92b11169a65b3f8cc512c75a252cbd0d096ba0 x86/EISA: Don't probe EISA bus for Xen PV guests
:::::: TO: Boris Ostrovsky <[email protected]> :::::: CC: Thomas Gleixner <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 1/1 x86/EISA: Remedy address space conflict
0-day reported a new sparse warning:
arch/x86/kernel/eisa.c:20:24: sparse:
incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] __iomem *addr got void *[assigned] p
Cure it by removing the readl() and dereferencing the pointer directly, which is correct as it's a memory access.
--- arch/x86/kernel/eisa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/eisa.c +2 -2
@@ -11,13 +11,13 @@static __init int eisa_bus_probe (void ) { -void *p; +u32 *p;if ((xen_pv_domain () && !xen_initial_domain ()) ||cc_platform_has (CC_ATTR_GUEST_SEV_SNP ))return 0 ; p =memremap (0x0FFFD9 ,4 ,MEMREMAP_WB ); -if (p &&readl (p) =='E' + ('I' <<8 ) + ('S' <<16 ) + ('A' <<24 )) +if (p && *p =='E' + ('I' <<8 ) + ('S' <<16 ) + ('A' <<24 )) EISA_bus =1 ;memunmap (p);return 0 ;