Skip to contentSkip to conversation

x86: mce: fix type mismatch warning

PATCH In review Arnd Bergmann 2 participants 2 messages Jan 10, 2018 – Jan 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: mce: fix type mismatch warning

The printed symbol is a 64-bit address, so we get a warning when building this code for 32-bit kernels:

arch/x86/kernel/cpu/mcheck/mce.c: In function '__print_mce':
arch/x86/kernel/cpu/mcheck/mce.c:237:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

This uses an extra uintptr_t cast to avoid the warning.

Fixes 7b6061627eb8 ("x86: do not use print_symbol()")
---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +1 -1
index 26ee8c4c9b18..3b2f86c51a98 100644
@@ -234,7 +234,7 @@ static void __print_mce(struct mce *m)
 			m->cs, m->ip);
 
 		if (m->cs == __KERNEL_CS)
-			pr_cont("{%pS}", (void *)m->ip);
+			pr_cont("{%pS}", (void *)(uintptr_t)m->ip);
 		pr_cont("\n");
 	}
 
#1 lore raw
Quoted 9 lines · Arnd Bergmann

The printed symbol is a 64-bit address, so we get a warning when building this code for 32-bit kernels:

arch/x86/kernel/cpu/mcheck/mce.c: In function '__print_mce':
arch/x86/kernel/cpu/mcheck/mce.c:237:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

This uses an extra uintptr_t cast to avoid the warning.

Fixes 7b6061627eb8 ("x86: do not use print_symbol()")

I have no idea where this commit comes from .... It's neither in Linus tree nor in tip.

Thanks,

tglx
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html