public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [tip:x86/cleanups 3/9] arch/x86/kernel/eisa.c:20:24: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2024-08-26  4:15 kernel test robot
  2024-08-26  8:38 ` [PATCH] x86/EISA: Remedy address space conflict Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-08-26  4:15 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: oe-kbuild-all, linux-kernel, x86, Thomas Gleixner

tree:   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/202408261244.v2gfgSON-lkp@intel.com/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/202408261244.v2gfgSON-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408261244.v2gfgSON-lkp@intel.com/

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 <boris.ostrovsky@oracle.com>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] x86/EISA: Remedy address space conflict
  2024-08-26  4:15 [tip:x86/cleanups 3/9] arch/x86/kernel/eisa.c:20:24: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
@ 2024-08-26  8:38 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2024-08-26  8:38 UTC (permalink / raw)
  To: kernel test robot, Maciej W. Rozycki; +Cc: oe-kbuild-all, linux-kernel, x86

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.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 80a4da05642c ("x86/EISA: Use memremap() to probe for the EISA BIOS signature")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>
Closes: https://lore.kernel.org/oe-kbuild-all/202408261244.v2gfgSON-lkp@intel.com/
---
 arch/x86/kernel/eisa.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/eisa.c
+++ b/arch/x86/kernel/eisa.c
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-26  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  4:15 [tip:x86/cleanups 3/9] arch/x86/kernel/eisa.c:20:24: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2024-08-26  8:38 ` [PATCH] x86/EISA: Remedy address space conflict Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox