diff options
-rw-r--r-- | include/asm-generic/bug.h | 7 | ||||
-rw-r--r-- | kernel/panic.c | 32 |
2 files changed, 15 insertions, 24 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 12c07c1866b2..b8ba6941f587 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -33,15 +33,14 @@ struct bug_entry { | |||
33 | 33 | ||
34 | #ifndef __WARN | 34 | #ifndef __WARN |
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | extern void warn_on_slowpath(const char *file, const int line); | ||
37 | extern void warn_slowpath(const char *file, const int line, | 36 | extern void warn_slowpath(const char *file, const int line, |
38 | const char *fmt, ...) __attribute__((format(printf, 3, 4))); | 37 | const char *fmt, ...) __attribute__((format(printf, 3, 4))); |
39 | #define WANT_WARN_ON_SLOWPATH | 38 | #define WANT_WARN_ON_SLOWPATH |
40 | #endif | 39 | #endif |
41 | #define __WARN() warn_on_slowpath(__FILE__, __LINE__) | 40 | #define __WARN() warn_slowpath(__FILE__, __LINE__, NULL) |
42 | #define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) | 41 | #define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) |
43 | #else | 42 | #else |
44 | #define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) | 43 | #define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) |
45 | #endif | 44 | #endif |
46 | 45 | ||
47 | #ifndef WARN_ON | 46 | #ifndef WARN_ON |
diff --git a/kernel/panic.c b/kernel/panic.c index 4d5088355bfe..13f06349a786 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/debug_locks.h> | 21 | #include <linux/debug_locks.h> |
22 | #include <linux/random.h> | 22 | #include <linux/random.h> |
23 | #include <linux/kallsyms.h> | 23 | #include <linux/kallsyms.h> |
24 | #include <linux/dmi.h> | ||
24 | 25 | ||
25 | int panic_on_oops; | 26 | int panic_on_oops; |
26 | static unsigned long tainted_mask; | 27 | static unsigned long tainted_mask; |
@@ -321,36 +322,27 @@ void oops_exit(void) | |||
321 | } | 322 | } |
322 | 323 | ||
323 | #ifdef WANT_WARN_ON_SLOWPATH | 324 | #ifdef WANT_WARN_ON_SLOWPATH |
324 | void warn_on_slowpath(const char *file, int line) | ||
325 | { | ||
326 | char function[KSYM_SYMBOL_LEN]; | ||
327 | unsigned long caller = (unsigned long) __builtin_return_address(0); | ||
328 | sprint_symbol(function, caller); | ||
329 | |||
330 | printk(KERN_WARNING "------------[ cut here ]------------\n"); | ||
331 | printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file, | ||
332 | line, function); | ||
333 | print_modules(); | ||
334 | dump_stack(); | ||
335 | print_oops_end_marker(); | ||
336 | add_taint(TAINT_WARN); | ||
337 | } | ||
338 | EXPORT_SYMBOL(warn_on_slowpath); | ||
339 | |||
340 | |||
341 | void warn_slowpath(const char *file, int line, const char *fmt, ...) | 325 | void warn_slowpath(const char *file, int line, const char *fmt, ...) |
342 | { | 326 | { |
343 | va_list args; | 327 | va_list args; |
344 | char function[KSYM_SYMBOL_LEN]; | 328 | char function[KSYM_SYMBOL_LEN]; |
345 | unsigned long caller = (unsigned long)__builtin_return_address(0); | 329 | unsigned long caller = (unsigned long)__builtin_return_address(0); |
330 | const char *board; | ||
331 | |||
346 | sprint_symbol(function, caller); | 332 | sprint_symbol(function, caller); |
347 | 333 | ||
348 | printk(KERN_WARNING "------------[ cut here ]------------\n"); | 334 | printk(KERN_WARNING "------------[ cut here ]------------\n"); |
349 | printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file, | 335 | printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file, |
350 | line, function); | 336 | line, function); |
351 | va_start(args, fmt); | 337 | board = dmi_get_system_info(DMI_PRODUCT_NAME); |
352 | vprintk(fmt, args); | 338 | if (board) |
353 | va_end(args); | 339 | printk(KERN_WARNING "Hardware name: %s\n", board); |
340 | |||
341 | if (fmt) { | ||
342 | va_start(args, fmt); | ||
343 | vprintk(fmt, args); | ||
344 | va_end(args); | ||
345 | } | ||
354 | 346 | ||
355 | print_modules(); | 347 | print_modules(); |
356 | dump_stack(); | 348 | dump_stack(); |