mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: viro@zeniv.linux.org.uk, dhowells@redhat.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: fix undefined behavior in bit shift for SB_NOUSER
Date: Mon, 31 Oct 2022 06:15:32 -0700	[thread overview]
Message-ID: <Y1/KdOyExwCdfCqb@infradead.org> (raw)
In-Reply-To: <20221029071745.2836665-1-cuigaosheng1@huawei.com>

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.

  reply	other threads:[~2022-10-31 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29  7:17 Gaosheng Cui
2022-10-31 13:15 ` Christoph Hellwig [this message]
2022-10-31 13:56   ` cuigaosheng
2023-04-24  3:00 Hao Ge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1/KdOyExwCdfCqb@infradead.org \
    --to=hch@infradead.org \
    --cc=cuigaosheng1@huawei.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®