Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457335

[PATCH 1/1] x86/mm: kaslr: fix -Wformat-security warning

From Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Newsgroups linux.kernel
Subject [PATCH 1/1] x86/mm: kaslr: fix -Wformat-security warning
Date 2016-08-06 22:30 +0200
Message-ID <s3goi-263-41@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


debug_putstr() is used to output strings without using printf-like
formatting but debug_putstr(v) is defined as early_printk(v) in
arch/x86/lib/kaslr.c.  This makes clang reports the following warning
when building with -Wformat-security:

    arch/x86/lib/kaslr.c:57:15: warning: format string is not a string
    literal (potentially insecure) [-Wformat-security]
            debug_putstr(purpose);
                         ^~~~~~~

Fix this by using "%s" in early_printk().

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 arch/x86/lib/kaslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/lib/kaslr.c b/arch/x86/lib/kaslr.c
index f7dfeda83e5c..121f59c6ee54 100644
--- a/arch/x86/lib/kaslr.c
+++ b/arch/x86/lib/kaslr.c
@@ -19,7 +19,7 @@
 #include <asm/cpufeature.h>
 #include <asm/setup.h>
 
-#define debug_putstr(v) early_printk(v)
+#define debug_putstr(v) early_printk("%s", v)
 #define has_cpuflag(f) boot_cpu_has(f)
 #define get_boot_seed() kaslr_offset()
 #endif
-- 
2.9.2

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/1] x86/mm: kaslr: fix -Wformat-security warning Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-08-06 22:30 +0200

csiph-web