summaryrefslogtreecommitdiffstats
path: root/include/linux/highuid.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/highuid.h')
-rw-r--r--include/linux/highuid.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/include/linux/highuid.h b/include/linux/highuid.h
index 5d287bbb3..d5a9ff5d0 100644
--- a/include/linux/highuid.h
+++ b/include/linux/highuid.h
@@ -41,14 +41,14 @@ extern int overflowgid;
#ifdef CONFIG_UID16
/* prevent uid mod 65536 effect by returning a default value for high UIDs */
-#define high2lowuid(uid) ((uid) > 65535) ? (old_uid_t)overflowuid : (old_uid_t)(uid)
-#define high2lowgid(gid) ((gid) > 65535) ? (old_gid_t)overflowgid : (old_gid_t)(gid)
+#define high2lowuid(uid) ((uid) > 65535 ? (old_uid_t)overflowuid : (old_uid_t)(uid))
+#define high2lowgid(gid) ((gid) > 65535 ? (old_gid_t)overflowgid : (old_gid_t)(gid))
/*
* -1 is different in 16 bits than it is in 32 bits
* these macros are used by chown(), setreuid(), ...,
*/
-#define low2highuid(uid) ((uid) == (old_uid_t)-1) ? (uid_t)-1 : (uid_t)(uid)
-#define low2highgid(gid) ((gid) == (old_gid_t)-1) ? (gid_t)-1 : (gid_t)(gid)
+#define low2highuid(uid) ((uid) == (old_uid_t)-1 ? (uid_t)-1 : (uid_t)(uid))
+#define low2highgid(gid) ((gid) == (old_gid_t)-1 ? (gid_t)-1 : (gid_t)(gid))
/* Avoid extra ifdefs with these macros */
@@ -67,13 +67,13 @@ extern int overflowgid;
#define SET_UID16(var, uid) do { ; } while (0)
#define SET_GID16(var, gid) do { ; } while (0)
-#define NEW_TO_OLD_UID(uid) uid
-#define NEW_TO_OLD_GID(gid) gid
+#define NEW_TO_OLD_UID(uid) (uid)
+#define NEW_TO_OLD_GID(gid) (gid)
-#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = uid
-#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = gid
-#define SET_STAT_UID(stat, uid) (stat).st_uid = uid
-#define SET_STAT_GID(stat, gid) (stat).st_gid = gid
+#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = (uid)
+#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = (gid)
+#define SET_STAT_UID(stat, uid) (stat).st_uid = (uid)
+#define SET_STAT_GID(stat, gid) (stat).st_gid = (gid)
#endif /* CONFIG_UID16 */
@@ -97,10 +97,10 @@ extern int fs_overflowgid;
* Since these macros are used in architectures that only need limited
* 16-bit UID back compatibility, we won't use old_uid_t and old_gid_t
*/
-#define fs_high2lowuid(uid) (uid > 65535) ? (uid16_t)fs_overflowuid : (uid16_t)uid
-#define fs_high2lowgid(gid) (gid > 65535) ? (gid16_t)fs_overflowgid : (gid16_t)gid
+#define fs_high2lowuid(uid) ((uid) > 65535 ? (uid16_t)fs_overflowuid : (uid16_t)(uid))
+#define fs_high2lowgid(gid) ((gid) > 65535 ? (gid16_t)fs_overflowgid : (gid16_t)(gid))
-#define low_16_bits(x) x & 0xFFFF
-#define high_16_bits(x) (x & 0xFFFF0000) >> 16
+#define low_16_bits(x) ((x) & 0xFFFF)
+#define high_16_bits(x) (((x) & 0xFFFF0000) >> 16)
#endif /* _LINUX_HIGHUID_H */