Skip to content

Commit

Permalink
[PATCH] Fix missing parens in set_personality()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King authored and Linus Torvalds committed Nov 13, 2006
1 parent e40c675 commit d8b295f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/personality.h
Expand Up @@ -114,7 +114,7 @@ struct exec_domain {
* 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__ */

Expand Down

0 comments on commit d8b295f

Please sign in to comment.