aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/panic.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index 8b2e002d52eb..f6d549a29a5c 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -136,7 +136,7 @@ void panic(const char *fmt, ...)
136{ 136{
137 static char buf[1024]; 137 static char buf[1024];
138 va_list args; 138 va_list args;
139 long i, i_next = 0; 139 long i, i_next = 0, len;
140 int state = 0; 140 int state = 0;
141 int old_cpu, this_cpu; 141 int old_cpu, this_cpu;
142 bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; 142 bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers;
@@ -173,8 +173,12 @@ void panic(const char *fmt, ...)
173 console_verbose(); 173 console_verbose();
174 bust_spinlocks(1); 174 bust_spinlocks(1);
175 va_start(args, fmt); 175 va_start(args, fmt);
176 vsnprintf(buf, sizeof(buf), fmt, args); 176 len = vscnprintf(buf, sizeof(buf), fmt, args);
177 va_end(args); 177 va_end(args);
178
179 if (len && buf[len - 1] == '\n')
180 buf[len - 1] = '\0';
181
178 pr_emerg("Kernel panic - not syncing: %s\n", buf); 182 pr_emerg("Kernel panic - not syncing: %s\n", buf);
179#ifdef CONFIG_DEBUG_BUGVERBOSE 183#ifdef CONFIG_DEBUG_BUGVERBOSE
180 /* 184 /*
@@ -631,7 +635,7 @@ device_initcall(register_warn_debugfs);
631 */ 635 */
632__visible void __stack_chk_fail(void) 636__visible void __stack_chk_fail(void)
633{ 637{
634 panic("stack-protector: Kernel stack is corrupted in: %pB\n", 638 panic("stack-protector: Kernel stack is corrupted in: %pB",
635 __builtin_return_address(0)); 639 __builtin_return_address(0));
636} 640}
637EXPORT_SYMBOL(__stack_chk_fail); 641EXPORT_SYMBOL(__stack_chk_fail);