Re: [PATCH] fs: fix undefined behavior in bit shift for SB_NOUSER
From: Christoph Hellwig
Date: Mon Oct 31 2022 - 09:15:45 EST
On Sat, Oct 29, 2022 at 03:17:45PM +0800, Gaosheng Cui wrote:
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1396,7 +1396,7 @@ extern int send_sigurg(struct fown_struct *fown);
> #define SB_NOSEC (1<<28)
> #define SB_BORN (1<<29)
> #define SB_ACTIVE (1<<30)
> -#define SB_NOUSER (1<<31)
> +#define SB_NOUSER (1U<<31)
Let's mark all of the flags as unsigned instead of just one so that
we don't mix types. s_flags is already unsigned (although for some
reason long) already.
And while you touch this please add the proper whitespaces around the
shift operator everywhere.