diff options
author | Anton Blanchard <anton@samba.org> | 2010-08-10 21:03:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:22 -0400 |
commit | e2e7e093259d4c6b73b432122974393d6fcdfc2a (patch) | |
tree | d8a5ff294a21c074724539f4fc8f9b7783ae96b4 /lib/bug.c | |
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
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/bug.c')
-rw-r--r-- | lib/bug.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -136,8 +136,6 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
136 | 136 | ||
137 | bug = find_bug(bugaddr); | 137 | bug = find_bug(bugaddr); |
138 | 138 | ||
139 | printk(KERN_EMERG "------------[ cut here ]------------\n"); | ||
140 | |||
141 | file = NULL; | 139 | file = NULL; |
142 | line = 0; | 140 | line = 0; |
143 | warning = 0; | 141 | warning = 0; |
@@ -156,19 +154,24 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
156 | 154 | ||
157 | if (warning) { | 155 | if (warning) { |
158 | /* this is a WARN_ON rather than BUG/BUG_ON */ | 156 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
157 | printk(KERN_WARNING "------------[ cut here ]------------\n"); | ||
158 | |||
159 | if (file) | 159 | if (file) |
160 | printk(KERN_ERR "Badness at %s:%u\n", | 160 | printk(KERN_WARNING "WARNING: at %s:%u\n", |
161 | file, line); | 161 | file, line); |
162 | else | 162 | else |
163 | printk(KERN_ERR "Badness at %p " | 163 | printk(KERN_WARNING "WARNING: at %p " |
164 | "[verbose debug info unavailable]\n", | 164 | "[verbose debug info unavailable]\n", |
165 | (void *)bugaddr); | 165 | (void *)bugaddr); |
166 | 166 | ||
167 | print_modules(); | ||
167 | show_regs(regs); | 168 | show_regs(regs); |
168 | add_taint(BUG_GET_TAINT(bug)); | 169 | add_taint(BUG_GET_TAINT(bug)); |
169 | return BUG_TRAP_TYPE_WARN; | 170 | return BUG_TRAP_TYPE_WARN; |
170 | } | 171 | } |
171 | 172 | ||
173 | printk(KERN_EMERG "------------[ cut here ]------------\n"); | ||
174 | |||
172 | if (file) | 175 | if (file) |
173 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", | 176 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", |
174 | file, line); | 177 | file, line); |