[PATCH] x86/EISA: Remedy address space conflict

Thomas Gleixner posted 1 patch 1 year, 3 months ago
arch/x86/kernel/eisa.c |    4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] x86/EISA: Remedy address space conflict
Posted by Thomas Gleixner 1 year, 3 months ago
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;