From: Borislav Petkov <b...@suse.de>

7b6061627eb8 ("x86: do not use print_symbol()") got rid of
print_symbol() uses in favor of passing a %pS format specifier to
printk() in order to print "symbolic direct pointers with offset".

We use this to print the RIP as part of the MCE record. And %pS requires
a void *.

However, mce.ip is u64 and casting it to a void * on 32-bit rightfully
warns:

  arch/x86/kernel/cpu/mcheck/mce.c:237:21: warning: cast to pointer from 
integer \
          of different size [-Wint-to-pointer-cast]
      pr_cont("{%pS}", (void *)m->ip);
                       ^

about the size mismatch.

So cast the RIP to the machine-specific unsigned long address width
first.

Signed-off-by: Borislav Petkov <b...@suse.de>
Cc: Sergey Senozhatsky <sergey.senozhatsky.w...@gmail.com>
Fixes: 7b6061627eb8 ("x86: do not use print_symbol()")
---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 3a8e88a611eb..75f405ac085c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -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 *)(unsigned long)m->ip);
                pr_cont("\n");
        }
 
-- 
2.13.0

Reply via email to