[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1/KdOyExwCdfCqb@infradead.org>
Date: Mon, 31 Oct 2022 06:15:32 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Gaosheng Cui <cuigaosheng1@...wei.com>
Cc: viro@...iv.linux.org.uk, dhowells@...hat.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: fix undefined behavior in bit shift for SB_NOUSER
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.
Powered by blists - more mailing lists