linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix usage of true and false as field names in struct taint_flag
@ 2016-12-22 18:56 Valdis Kletnieks
  2016-12-23 11:59 ` Petr Mladek
  0 siblings, 1 reply; 4+ messages in thread
From: Valdis Kletnieks @ 2016-12-22 18:56 UTC (permalink / raw)
  To: Petr Mladek, Jessica Yu; +Cc: linux-kernel, Andrew Morton, Al Viro

commit 7fd8329ba502ef76dd91db561c7aed696b2c7720
Author: Petr Mladek <pmladek@suse.com>
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.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix usage of true and false as field names in struct taint_flag
  2016-12-22 18:56 [PATCH] Fix usage of true and false as field names in struct taint_flag Valdis Kletnieks
@ 2016-12-23 11:59 ` Petr Mladek
  2016-12-26 23:50   ` Valdis.Kletnieks
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Mladek @ 2016-12-23 11:59 UTC (permalink / raw)
  To: Valdis Kletnieks; +Cc: Jessica Yu, linux-kernel, Andrew Morton, Al Viro

On Thu 2016-12-22 13:56:38, Valdis Kletnieks wrote:
> commit 7fd8329ba502ef76dd91db561c7aed696b2c7720
> Author: Petr Mladek <pmladek@suse.com>
> 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

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

> 
> +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@vt.edu>

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

Reviewed-by: Petr Mladek <pmladek@suse.com>

Thanks for the fix.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix usage of true and false as field names in struct taint_flag
  2016-12-23 11:59 ` Petr Mladek
@ 2016-12-26 23:50   ` Valdis.Kletnieks
  0 siblings, 0 replies; 4+ messages in thread
From: Valdis.Kletnieks @ 2016-12-26 23:50 UTC (permalink / raw)
  To: Petr Mladek; +Cc: Jessica Yu, linux-kernel, Andrew Morton, Al Viro

On Fri, 23 Dec 2016 12:59:35 +0100, Petr Mladek said:
> On Thu 2016-12-22 13:56:38, Valdis Kletnieks wrote:
> > commit 7fd8329ba502ef76dd91db561c7aed696b2c7720
> > Author: Petr Mladek <pmladek@suse.com>
> > 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: 

Gaah.  -ENOCAFFEINE. :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Fix usage of true and false as field names in struct taint_flag
@ 2016-12-26 23:49 Valdis Kletnieks
  0 siblings, 0 replies; 4+ messages in thread
From: Valdis Kletnieks @ 2016-12-26 23:49 UTC (permalink / raw)
  To: Petr Mladek, Jessica Yu; +Cc: linux-kernel, Andrew Morton, Al Viro

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@vt.edu>
Reviewed-by: Petr Mladek <pmladek@suse.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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-27  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 18:56 [PATCH] Fix usage of true and false as field names in struct taint_flag Valdis Kletnieks
2016-12-23 11:59 ` Petr Mladek
2016-12-26 23:50   ` Valdis.Kletnieks
2016-12-26 23:49 Valdis Kletnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).