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


Groups > linux.kernel > #1547107 > unrolled thread

[RFC] taint/module: Fix problems when out-of-kernel driver defines true or false

Started byLarry Finger <Larry.Finger@lwfinger.net>
First post2016-12-24 21:00 +0100
Last post2017-01-03 04:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RFC] taint/module: Fix problems when out-of-kernel driver defines true or false Larry Finger <Larry.Finger@lwfinger.net> - 2016-12-24 21:00 +0100
    Re: [RFC] taint/module: Fix problems when out-of-kernel driver defines true or false Rusty Russell <rusty@rustcorp.com.au> - 2017-01-03 04:40 +0100

#1547107 — [RFC] taint/module: Fix problems when out-of-kernel driver defines true or false

FromLarry Finger <Larry.Finger@lwfinger.net>
Date2016-12-24 21:00 +0100
Subject[RFC] taint/module: Fix problems when out-of-kernel driver defines true or false
Message-ID<sS0E2-2KN-7@gated-at.bofh.it>
Commit 7fd8329ba502 ("taint/module: Clean up global and module taint
flags handling") used the key words true and false as character members
of a new struct. These names cause problems when out-of-kernel modules
such as VirtualBox include their own definitions of true and false.

Fixes: 7fd8329ba502 ("taint/module: Clean up global and module taint flags handling")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Jessica Yu <jeyu@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/kernel.h | 4 ++--
 kernel/module.c        | 2 +-
 kernel/panic.c         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 56aec84..cb09238 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 c_true;	/* character printed when tainted */
+	char c_false;	/* 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 f7482db..5f7d482 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].c_true;
 	}
 
 	return l;
diff --git a/kernel/panic.c b/kernel/panic.c
index c51edaa..901c4fb 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->c_true : t->c_false;
 		}
 		*s = 0;
 	} else
-- 
2.10.2

[toc] | [next] | [standalone]


#1549514

FromRusty Russell <rusty@rustcorp.com.au>
Date2017-01-03 04:40 +0100
Message-ID<sVo77-5x-3@gated-at.bofh.it>
In reply to#1547107
Larry Finger <Larry.Finger@lwfinger.net> writes:
> Commit 7fd8329ba502 ("taint/module: Clean up global and module taint
> flags handling") used the key words true and false as character members
> of a new struct. These names cause problems when out-of-kernel modules
> such as VirtualBox include their own definitions of true and false.
>
> Fixes: 7fd8329ba502 ("taint/module: Clean up global and module taint flags handling")
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Jessica Yu <jeyu@redhat.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks,
Rusty.

> ---
>  include/linux/kernel.h | 4 ++--
>  kernel/module.c        | 2 +-
>  kernel/panic.c         | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 56aec84..cb09238 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 c_true;	/* character printed when tainted */
> +	char c_false;	/* 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 f7482db..5f7d482 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].c_true;
>  	}
>  
>  	return l;
> diff --git a/kernel/panic.c b/kernel/panic.c
> index c51edaa..901c4fb 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->c_true : t->c_false;
>  		}
>  		*s = 0;
>  	} else
> -- 
> 2.10.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web