Commit b7015331 authored by Chuck Ebbert's avatar Chuck Ebbert Committed by Linus Torvalds

[PATCH] i386: handle_BUG(): don't print garbage if debug info unavailable

handle_BUG() tries to print file and line number even when they're not
available (CONFIG_DEBUG_BUGVERBOSE is not set.) Change this to print a
message stating info is unavailable instead of printing a misleading
message.
Signed-off-by: default avatarChuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c38c8db7
...@@ -324,35 +324,35 @@ void show_registers(struct pt_regs *regs) ...@@ -324,35 +324,35 @@ void show_registers(struct pt_regs *regs)
static void handle_BUG(struct pt_regs *regs) static void handle_BUG(struct pt_regs *regs)
{ {
unsigned long eip = regs->eip;
unsigned short ud2; unsigned short ud2;
unsigned short line;
char *file;
char c;
unsigned long eip;
eip = regs->eip;
if (eip < PAGE_OFFSET) if (eip < PAGE_OFFSET)
goto no_bug; return;
if (__get_user(ud2, (unsigned short __user *)eip)) if (__get_user(ud2, (unsigned short __user *)eip))
goto no_bug; return;
if (ud2 != 0x0b0f) if (ud2 != 0x0b0f)
goto no_bug; return;
printk(KERN_EMERG "------------[ cut here ]------------\n");
#ifdef CONFIG_DEBUG_BUGVERBOSE
do {
unsigned short line;
char *file;
char c;
if (__get_user(line, (unsigned short __user *)(eip + 2))) if (__get_user(line, (unsigned short __user *)(eip + 2)))
goto bug; break;
if (__get_user(file, (char * __user *)(eip + 4)) || if (__get_user(file, (char * __user *)(eip + 4)) ||
(unsigned long)file < PAGE_OFFSET || __get_user(c, file)) (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
file = "<bad filename>"; file = "<bad filename>";
printk(KERN_EMERG "------------[ cut here ]------------\n");
printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
no_bug:
return; return;
} while (0);
/* Here we know it was a BUG but file-n-line is unavailable */ #endif
bug: printk(KERN_EMERG "Kernel BUG at [verbose debug info unavailable]\n");
printk(KERN_EMERG "Kernel BUG\n");
} }
/* This is gone through when something in the kernel /* This is gone through when something in the kernel
......
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