aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-generic/bug.h7
-rw-r--r--kernel/panic.c13
2 files changed, 14 insertions, 6 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index e727fe0d1451..4b6755984d24 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -58,12 +58,13 @@ struct bug_entry {
58 */ 58 */
59#ifndef __WARN 59#ifndef __WARN
60#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
61extern void warn_slowpath(const char *file, const int line, 61extern void warn_slowpath_fmt(const char *file, const int line,
62 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 62 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
63extern void warn_slowpath_null(const char *file, const int line);
63#define WANT_WARN_ON_SLOWPATH 64#define WANT_WARN_ON_SLOWPATH
64#endif 65#endif
65#define __WARN() warn_slowpath(__FILE__, __LINE__, NULL) 66#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
66#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) 67#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
67#else 68#else
68#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 69#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
69#endif 70#endif
diff --git a/kernel/panic.c b/kernel/panic.c
index 3dcaa1661357..874ecf1307ae 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -340,7 +340,7 @@ void oops_exit(void)
340} 340}
341 341
342#ifdef WANT_WARN_ON_SLOWPATH 342#ifdef WANT_WARN_ON_SLOWPATH
343void warn_slowpath(const char *file, int line, const char *fmt, ...) 343void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
344{ 344{
345 va_list args; 345 va_list args;
346 char function[KSYM_SYMBOL_LEN]; 346 char function[KSYM_SYMBOL_LEN];
@@ -356,7 +356,7 @@ void warn_slowpath(const char *file, int line, const char *fmt, ...)
356 if (board) 356 if (board)
357 printk(KERN_WARNING "Hardware name: %s\n", board); 357 printk(KERN_WARNING "Hardware name: %s\n", board);
358 358
359 if (fmt) { 359 if (*fmt) {
360 va_start(args, fmt); 360 va_start(args, fmt);
361 vprintk(fmt, args); 361 vprintk(fmt, args);
362 va_end(args); 362 va_end(args);
@@ -367,7 +367,14 @@ void warn_slowpath(const char *file, int line, const char *fmt, ...)
367 print_oops_end_marker(); 367 print_oops_end_marker();
368 add_taint(TAINT_WARN); 368 add_taint(TAINT_WARN);
369} 369}
370EXPORT_SYMBOL(warn_slowpath); 370EXPORT_SYMBOL(warn_slowpath_fmt);
371
372void warn_slowpath_null(const char *file, int line)
373{
374 static const char *empty = "";
375 warn_slowpath_fmt(file, line, empty);
376}
377EXPORT_SYMBOL(warn_slowpath_null);
371#endif 378#endif
372 379
373#ifdef CONFIG_CC_STACKPROTECTOR 380#ifdef CONFIG_CC_STACKPROTECTOR