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]
Message-ID: <195925.1482796188@turing-police.cc.vt.edu>
Date:   Mon, 26 Dec 2016 18:49:48 -0500
From:   Valdis Kletnieks <Valdis.Kletnieks@...edu>
To:     Petr Mladek <pmladek@...e.com>, Jessica Yu <jeyu@...hat.com>
cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Al Viro <viro@...IV.linux.org.uk>
Subject: [PATCH] Fix usage of true and false as field names in struct taint_flag

The commit 7fd8329ba502ef76dd ("taint/module: Clean up global and
module taint flags handling") contains this chunk: 

+struct taint_flag {
+       char true;      /* character printed when tainted */
+       char false;     /* character printed when not tainted */
+       bool module;    /* also show as a per-module taint flag */
+};

and hilarity ensues when an out-of-tree module has this:

# ifndef true
#  define true  (1)
# endif
# ifndef false
#  define false (0)
# endif

Change the field names to not shadow something likely to be used
by third-party modules.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@...edu>
Reviewed-by: Petr Mladek <pmladek@...e.com>

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 56aec84237ad..420d4b87feb0 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -514,8 +514,8 @@ extern enum system_states {
 #define TAINT_FLAGS_COUNT		16
 
 struct taint_flag {
-	char true;	/* character printed when tainted */
-	char false;	/* character printed when not tainted */
+	char tainted;	/* character printed when tainted */
+	char untainted;	/* character printed when not tainted */
 	bool module;	/* also show as a per-module taint flag */
 };
 
diff --git a/kernel/module.c b/kernel/module.c
index f7482db0f843..6a0434de5dbd 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1145,7 +1145,7 @@ static size_t module_flags_taint(struct module *mod, char *buf)
 
 	for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
 		if (taint_flags[i].module && test_bit(i, &mod->taints))
-			buf[l++] = taint_flags[i].true;
+			buf[l++] = taint_flags[i].tainted;
 	}
 
 	return l;
diff --git a/kernel/panic.c b/kernel/panic.c
index c51edaa04fce..e02da0928910 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -355,7 +355,7 @@ const char *print_tainted(void)
 		for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
 			const struct taint_flag *t = &taint_flags[i];
 			*s++ = test_bit(i, &tainted_mask) ?
-					t->true : t->false;
+					t->tainted : t->untainted;
 		}
 		*s = 0;
 	} else



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ