[PATCH 01/45] Use UINT_MAX, not -1, to represent an invalid UID, GID or project ID

From: David Howells
Date: Sun Apr 01 2018 - 16:40:29 EST


Use UINT_MAX, not -1, to represent an invalid UID, GID or project ID as the
parameter is an unsigned integer.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

include/linux/projid.h | 2 +-
include/linux/uidgid.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/projid.h b/include/linux/projid.h
index 613730622a1a..7c60a79424c9 100644
--- a/include/linux/projid.h
+++ b/include/linux/projid.h
@@ -30,7 +30,7 @@ static inline projid_t __kprojid_val(kprojid_t projid)

#define KPROJIDT_INIT(value) (kprojid_t){ value }

-#define INVALID_PROJID KPROJIDT_INIT(-1)
+#define INVALID_PROJID KPROJIDT_INIT(UINT_MAX)
#define OVERFLOW_PROJID 65534

static inline bool projid_eq(kprojid_t left, kprojid_t right)
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index b0542cd11aeb..75f602075b63 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -55,8 +55,8 @@ static inline gid_t __kgid_val(kgid_t gid)
#define GLOBAL_ROOT_UID KUIDT_INIT(0)
#define GLOBAL_ROOT_GID KGIDT_INIT(0)

-#define INVALID_UID KUIDT_INIT(-1)
-#define INVALID_GID KGIDT_INIT(-1)
+#define INVALID_UID KUIDT_INIT(UINT_MAX)
+#define INVALID_GID KGIDT_INIT(UINT_MAX)

static inline bool uid_eq(kuid_t left, kuid_t right)
{