mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 13:54:57 +08:00
powerpc/mm: Make NULL pointer deferences explicit on bad page faults.
As several other arches including x86, this patch makes it explicit that a bad page fault is a NULL pointer dereference when the fault address is lower than PAGE_SIZE In the mean time, this page makes all bad_page_fault() messages shorter so that they remain on one single line. And it prefixes them by "BUG: " so that they get easily grepped. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> [mpe: Avoid pr_cont()] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
8dbdec0bcb
commit
49a502ea23
@ -650,21 +650,22 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
|
|||||||
switch (TRAP(regs)) {
|
switch (TRAP(regs)) {
|
||||||
case 0x300:
|
case 0x300:
|
||||||
case 0x380:
|
case 0x380:
|
||||||
printk(KERN_ALERT "Unable to handle kernel paging request for "
|
pr_alert("BUG: %s at 0x%08lx\n",
|
||||||
"data at address 0x%08lx\n", regs->dar);
|
regs->dar < PAGE_SIZE ? "Kernel NULL pointer dereference" :
|
||||||
|
"Unable to handle kernel data access", regs->dar);
|
||||||
break;
|
break;
|
||||||
case 0x400:
|
case 0x400:
|
||||||
case 0x480:
|
case 0x480:
|
||||||
printk(KERN_ALERT "Unable to handle kernel paging request for "
|
pr_alert("BUG: Unable to handle kernel instruction fetch%s",
|
||||||
"instruction fetch\n");
|
regs->nip < PAGE_SIZE ? " (NULL pointer?)\n" : "\n");
|
||||||
break;
|
break;
|
||||||
case 0x600:
|
case 0x600:
|
||||||
printk(KERN_ALERT "Unable to handle kernel paging request for "
|
pr_alert("BUG: Unable to handle kernel unaligned access at 0x%08lx\n",
|
||||||
"unaligned access at address 0x%08lx\n", regs->dar);
|
regs->dar);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ALERT "Unable to handle kernel paging request for "
|
pr_alert("BUG: Unable to handle unknown paging fault at 0x%08lx\n",
|
||||||
"unknown fault\n");
|
regs->dar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n",
|
printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user