Skip to contentSkip to conversation

Fix missing parens in set_personality()

PATCH New Russell King 1 participant 1 message Nov 9, 2006 Personality handling

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix missing parens in set_personality()

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)) ? ...
include/linux/personality.h +1 -1
index bf4cf20..012cd55 100644
@@ -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__ */
 
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core