lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Oct 2018 23:20:34 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Alexey Dobriyan <adobriyan@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: [PATCH] fs: proc: move linux_proc_banner to where it is used

With -Wformat-literal, gcc complains

fs/proc/version.c:11:16: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
  seq_printf(m, linux_proc_banner,

linux_proc_banner is only used in this one place, so move the definition
here, to allow the compiler to complain in the unlikely case one of the
LINUX_* strings ended up containing a %. This also avoids compiling it
in for !CONFIG_PROC_FS.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 fs/proc/version.c      | 6 ++++++
 include/linux/printk.h | 1 -
 init/version.c         | 5 -----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/proc/version.c b/fs/proc/version.c
index b449f186577f..40a33e1434d7 100644
--- a/fs/proc/version.c
+++ b/fs/proc/version.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <generated/compile.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -6,6 +7,11 @@
 #include <linux/seq_file.h>
 #include <linux/utsname.h>
 
+#define linux_proc_banner \
+	"%s version %s" \
+	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" \
+	" (" LINUX_COMPILER ") %s\n"
+
 static int version_proc_show(struct seq_file *m, void *v)
 {
 	seq_printf(m, linux_proc_banner,
diff --git a/include/linux/printk.h b/include/linux/printk.h
index cf3eccfe1543..c7edf4398e4d 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -9,7 +9,6 @@
 #include <linux/cache.h>
 
 extern const char linux_banner[];
-extern const char linux_proc_banner[];
 
 #define PRINTK_MAX_SINGLE_HEADER_LEN 2
 
diff --git a/init/version.c b/init/version.c
index ef4012ec4375..ead5e21fa3a3 100644
--- a/init/version.c
+++ b/init/version.c
@@ -46,9 +46,4 @@ const char linux_banner[] =
 	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
 
-const char linux_proc_banner[] =
-	"%s version %s"
-	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
-	" (" LINUX_COMPILER ") %s\n";
-
 BUILD_SALT;
-- 
2.19.1.6.gbde171bbf5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ