linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: traps.c: use format string with panic() call
@ 2018-10-26 22:20 Rasmus Villemoes
  2018-10-29 11:35 ` [tip:x86/urgent] x86/traps: Use " tip-bot for Rasmus Villemoes
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2018-10-26 22:20 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86
  Cc: Rasmus Villemoes, linux-kernel

Building with -Wformat-nonliteral gives

arch/x86/kernel/traps.c:334:2: warning: format not a string literal and no format arguments [-Wformat-nonliteral]
  panic(message);

handle_stack_overflow can only be called from two places (kernel/traps.c
and via inline asm in mm/fault.c), in both cases with a string not
containing format specifiers, but we might as well silence this warning
using "%s" as format string.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8f6dcd88202e..9b7c4ca8f0a7 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -306,7 +306,7 @@ __visible void __noreturn handle_stack_overflow(const char *message,
 	die(message, regs, 0);
 
 	/* Be absolutely certain we don't return. */
-	panic(message);
+	panic("%s", message);
 }
 #endif
 
-- 
2.19.1.6.gbde171bbf5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/urgent] x86/traps: Use format string with panic() call
  2018-10-26 22:20 [PATCH] x86: traps.c: use format string with panic() call Rasmus Villemoes
@ 2018-10-29 11:35 ` tip-bot for Rasmus Villemoes
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Rasmus Villemoes @ 2018-10-29 11:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, hpa, linux-kernel, linux, bp, peterz, mingo, torvalds

Commit-ID:  2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb
Gitweb:     https://git.kernel.org/tip/2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb
Author:     Rasmus Villemoes <linux@rasmusvillemoes.dk>
AuthorDate: Sat, 27 Oct 2018 00:20:04 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 29 Oct 2018 07:19:26 +0100

x86/traps: Use format string with panic() call

Building with -Wformat-nonliteral gives:

  arch/x86/kernel/traps.c:334:2: warning: format not a string literal and no format arguments [-Wformat-nonliteral]
    panic(message);

handle_stack_overflow() can only be called from two places (kernel/traps.c
and via inline asm in mm/fault.c), in both cases with a string not
containing format specifiers, so we might as well silence this warning
using "%s" as a format string.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20181026222004.14193-1-linux@rasmusvillemoes.dk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 8f6dcd88202e..9b7c4ca8f0a7 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -306,7 +306,7 @@ __visible void __noreturn handle_stack_overflow(const char *message,
 	die(message, regs, 0);
 
 	/* Be absolutely certain we don't return. */
-	panic(message);
+	panic("%s", message);
 }
 #endif
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-29 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 22:20 [PATCH] x86: traps.c: use format string with panic() call Rasmus Villemoes
2018-10-29 11:35 ` [tip:x86/urgent] x86/traps: Use " tip-bot for Rasmus Villemoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).