Commit d8b295f29091310d746509bb6d5828aaf4907a18

Authored by Russell King
Committed by Linus Torvalds
1 parent e40c67597e

[PATCH] 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)) ? ...

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

include/linux/personality.h
... ... @@ -114,7 +114,7 @@
114 114 * Change personality of the currently running process.
115 115 */
116 116 #define set_personality(pers) \
117   - ((current->personality == pers) ? 0 : __set_personality(pers))
  117 + ((current->personality == (pers)) ? 0 : __set_personality(pers))
118 118  
119 119 #endif /* __KERNEL__ */
120 120