diff options
author | Anton Blanchard <[email protected]> | 2010-08-10 18:03:29 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2010-08-11 08:59:22 -0700 |
commit | e2e7e093259d4c6b73b432122974393d6fcdfc2a (patch) | |
tree | d8a5ff294a21c074724539f4fc8f9b7783ae96b4 | |
parent | c7ff0d9c92435e836e13aaa8d0e56d4000424bcc (diff) |
lib/bug.c: make WARN implementation match the kernel/panic.c one
There are a few issues with the exception based WARN implementation in
lib/bug.c:
- Inconsistent printk flags. The "cut here" line is printed at KERN_EMERG, so
the console and all logged in users see the single line:
------------[ cut here ]------------
for each WARN. Fix this so we print everything at KERN_WARNING to match the
kernel/panic.c version.
- The lib/bug.c WARN would print "Badness at". Change it to match the
kernel/panic.c version which prints "WARNING: at".
- Print the list of modules, similar to kernel/panic.c of modules, similar to
kernel/panic.c
[[email protected]: coding-style fixes]
Signed-off-by: Anton Blanchard <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | lib/bug.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/bug.c b/lib/bug.c index f13daf435211..6c5b30cf3f0f 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -136,8 +136,6 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) bug = find_bug(bugaddr); - printk(KERN_EMERG "------------[ cut here ]------------\n"); - file = NULL; line = 0; warning = 0; @@ -156,19 +154,24 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) if (warning) { /* this is a WARN_ON rather than BUG/BUG_ON */ + printk(KERN_WARNING "------------[ cut here ]------------\n"); + if (file) - printk(KERN_ERR "Badness at %s:%u\n", + printk(KERN_WARNING "WARNING: at %s:%u\n", file, line); else - printk(KERN_ERR "Badness at %p " + printk(KERN_WARNING "WARNING: at %p " "[verbose debug info unavailable]\n", (void *)bugaddr); + print_modules(); show_regs(regs); add_taint(BUG_GET_TAINT(bug)); return BUG_TRAP_TYPE_WARN; } + printk(KERN_EMERG "------------[ cut here ]------------\n"); + if (file) printk(KERN_CRIT "kernel BUG at %s:%u!\n", file, line); |