Commit f294a8ce authored by Vegard Nossum's avatar Vegard Nossum Committed by Ingo Molnar

x86: small unifications of address printing

'man 3 printf' tells me that %p should be printed as if by %#x, but
this is not true for the kernel, which does not use the '0x' prefix
for the %p conversion specifier.

A small cast to (void *) is also prettier than #ifdef/#else/#endif.
Signed-off-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9d8ad5d6
...@@ -396,11 +396,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code, ...@@ -396,11 +396,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
printk(KERN_CONT "NULL pointer dereference"); printk(KERN_CONT "NULL pointer dereference");
else else
printk(KERN_CONT "paging request"); printk(KERN_CONT "paging request");
#ifdef CONFIG_X86_32 printk(KERN_CONT " at %p\n", (void *) address);
printk(KERN_CONT " at %08lx\n", address);
#else
printk(KERN_CONT " at %016lx\n", address);
#endif
printk(KERN_ALERT "IP:"); printk(KERN_ALERT "IP:");
printk_address(regs->ip, 1); printk_address(regs->ip, 1);
dump_pagetable(address); dump_pagetable(address);
...@@ -800,14 +796,10 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) ...@@ -800,14 +796,10 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
printk_ratelimit()) { printk_ratelimit()) {
printk( printk(
#ifdef CONFIG_X86_32 "%s%s[%d]: segfault at %lx ip %p sp %p error %lx",
"%s%s[%d]: segfault at %lx ip %08lx sp %08lx error %lx",
#else
"%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx",
#endif
task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
tsk->comm, task_pid_nr(tsk), address, regs->ip, tsk->comm, task_pid_nr(tsk), address,
regs->sp, error_code); (void *) regs->ip, (void *) regs->sp, error_code);
print_vma_addr(" in ", regs->ip); print_vma_addr(" in ", regs->ip);
printk("\n"); printk("\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment