public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix missing parens in set_personality()
@ 2006-11-09 13:46 Russell King
  0 siblings, 0 replies; only message in thread
From: Russell King @ 2006-11-09 13:46 UTC (permalink / raw)
  To: Linux Kernel List, Linus Torvalds, Andrew Morton

If you call set_personality() with an expression such as:

	set_personality(foo ? PERS_FOO1 : PERS_FOO2);

then this evaluates to:

	((current->personality == foo ? PERS_FOO1 : PERS_FOO2) ? ...

which is obviously not the intended result.  Add the missing parents
to ensure this gets evaluated as expected:

	((current->personality == (foo ? PERS_FOO1 : PERS_FOO2)) ? ...

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

diff --git a/include/linux/personality.h b/include/linux/personality.h
index bf4cf20..012cd55 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -114,7 +114,7 @@ #define get_personality		(current->perso
  * Change personality of the currently running process.
  */
 #define set_personality(pers) \
-	((current->personality == pers) ? 0 : __set_personality(pers))
+	((current->personality == (pers)) ? 0 : __set_personality(pers))
 
 #endif /* __KERNEL__ */
 

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-09 13:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-09 13:46 [PATCH] Fix missing parens in set_personality() Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox