From: Russell King Date: Fri, 10 Nov 2006 20:27:53 +0000 (-0800) Subject: [PATCH] Fix missing parens in set_personality() X-Git-Tag: v2.6.19-rc6~38 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8b295f29091310d746509bb6d5828aaf4907a18;p=linux-2.6 [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/personality.h b/include/linux/personality.h index bf4cf2080e..012cd55818 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -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__ */