Skip to contentSkip to conversation

Fix usage of true and false as field names in struct taint_flag

PATCH In review Valdis Kletnieks 2 participants 3 messages Dec 22, 2016 – Dec 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix usage of true and false as field names in struct taint_flag

commit 7fd8329ba502ef76dd91db561c7aed696b2c7720

Author: Petr Mladek <[email protected]>
Date:   Wed Sep 21 13:47:22 2016 +0200

taint/module: Clean up global and module taint flags handling

Contains this chunk:

--- a/include/linux/kernel.h

+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.

---

include/linux/kernel.h +2 -2
index 56aec84237ad..420d4b87feb0 100644
@@ -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 */
 };
 
kernel/module.c +1 -1
index f7482db0f843..6a0434de5dbd 100644
@@ -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;
kernel/panic.c +1 -1
index c51edaa04fce..e02da0928910 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Valdis Kletnieks

commit 7fd8329ba502ef76dd91db561c7aed696b2c7720

Author: Petr Mladek <[email protected]>
Date:   Wed Sep 21 13:47:22 2016 +0200

taint/module: Clean up global and module taint flags handling

Contains this chunk:

Information about a past commits is usually writted using the following notation:

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

See also Documentation/process/submitting-patches.rst

Quoted 1 line

--- a/include/linux/kernel.h

^^^

This delimits a standard signature and the commit message below will be ignored by git. You should omit it in the commit message.

Quoted 16 lines
(quoted diff) +5 -0
+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
Quoted 4 lines

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

The change itself looks fine. With the above fixes in the commit message, feel free to use

Thanks for the fix.

Best Regards,
Petr

#2 lore raw
Quoted 7 lines · Petr Mladek
Quoted 6 lines · Valdis Kletnieks

commit 7fd8329ba502ef76dd91db561c7aed696b2c7720

Author: Petr Mladek <[email protected]>
Date:   Wed Sep 21 13:47:22 2016 +0200

taint/module: Clean up global and module taint flags handling

Quoted 7 lines
Quoted 1 line

Contains this chunk:

Information about a past commits is usually writted using the following notation:

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

Gaah. -ENOCAFFEINE. :)