Thread (33 messages) 33 messages, 11 authors, 2022-07-11

Re: [PATCH 01/12] x86/mce: use correct format characters

From: Bill Wendling <morbo@google.com>
Date: 2022-06-09 23:19:01
Also in: alsa-devel, linux-acpi, linux-edac, linux-mm, lkml, llvm, netfilter-devel

On Thu, Jun 9, 2022 at 4:15 PM Randy Dunlap [off-list ref] wrote:
On 6/9/22 15:16, Bill Wendling wrote:
quoted
From: Bill Wendling <redacted>

When compiling with -Wformat, clang emits the following warnings:

arch/x86/kernel/cpu/mce/core.c:295:9: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                panic(msg);
                      ^~~

Use a string literal for the format string.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Bill Wendling <redacted>
---
 arch/x86/kernel/cpu/mce/core.c | 2 +-
 scripts/Makefile.extrawarn     | 4 ++--
Where is the scripts/ change?
I'm sorry about this. The change in that file was a mistake that I
reverted, but I forgot to change this part.

-bw
quoted
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 2c8ec5c71712..3d411b7c85ad 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -292,7 +292,7 @@ static noinstr void mce_panic(const char *msg, struct mce *final, char *exp)
      if (!fake_panic) {
              if (panic_timeout == 0)
                      panic_timeout = mca_cfg.panic_timeout;
-             panic(msg);
+             panic("%s", msg);
      } else
              pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
--
~Randy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help