lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84a48fa6-cd05-f666-e64c-5f913f942b0a@infradead.org>
Date:   Sun, 1 Apr 2018 16:04:58 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     David Howells <dhowells@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/45] Use UINT_MAX, not -1, to represent an invalid UID,
 GID or project ID

On 04/01/2018 01:40 PM, David Howells wrote:
> 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@...hat.com>
> ---
> 
>  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)

+#include <linux/kernel.h>

>  #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)

+#include <linux/kernel.h>

>  #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)
>  {
> 


-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ