kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	kernel-janitors <kernel-janitors@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs: clean up after mandatory file locking support removal
Date: Tue, 24 Aug 2021 15:00:32 +0200	[thread overview]
Message-ID: <CAKXUXMz99n0ixBQaM2HJxpHQ9ywYJ-yUAa0+WAmjczGhe4JQRQ@mail.gmail.com> (raw)
In-Reply-To: <552bb9bedfb1c36ea6aa5f7bdd3ab162b81f73d9.camel@kernel.org>

On Tue, Aug 24, 2021 at 1:56 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Tue, 2021-08-24 at 13:12 +0200, Lukas Bulwahn wrote:
> > Commit 3efee0567b4a ("fs: remove mandatory file locking support") removes
> > some operations in functions rw_verify_area() and remap_verify_area().
> >
> > As these functions are now simplified, do some syntactic clean-up as
> > follow-up to the removal as well, which was pointed out by compiler
> > warnings and static analysis.
> >
> > No functional change.
> >
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > ---
> > Jeff, please pick this clean-up patch on top of the commit above.
> >
> >  fs/read_write.c  | 10 +++-------
> >  fs/remap_range.c |  2 --
> >  2 files changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/fs/read_write.c b/fs/read_write.c
> > index ffe821b8588e..af057c57bdc6 100644
> > --- a/fs/read_write.c
> > +++ b/fs/read_write.c
> > @@ -365,12 +365,8 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
> >
> >  int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count)
> >  {
> > -     struct inode *inode;
> > -     int retval = -EINVAL;
> > -
> > -     inode = file_inode(file);
> >       if (unlikely((ssize_t) count < 0))
> > -             return retval;
> > +             return -EINVAL;
> >
> >       /*
> >        * ranged mandatory locking does not apply to streams - it makes sense
> > @@ -381,12 +377,12 @@ int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t
> >
> >               if (unlikely(pos < 0)) {
> >                       if (!unsigned_offsets(file))
> > -                             return retval;
> > +                             return -EINVAL;
> >                       if (count >= -pos) /* both values are in 0..LLONG_MAX */
> >                               return -EOVERFLOW;
> >               } else if (unlikely((loff_t) (pos + count) < 0)) {
> >                       if (!unsigned_offsets(file))
> > -                             return retval;
> > +                             return -EINVAL;
> >               }
> >       }
> >
> > diff --git a/fs/remap_range.c b/fs/remap_range.c
> > index ec6d26c526b3..6d4a9beaa097 100644
> > --- a/fs/remap_range.c
> > +++ b/fs/remap_range.c
> > @@ -99,8 +99,6 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
> >  static int remap_verify_area(struct file *file, loff_t pos, loff_t len,
> >                            bool write)
> >  {
> > -     struct inode *inode = file_inode(file);
> > -
> >       if (unlikely(pos < 0 || len < 0))
> >               return -EINVAL;
> >
>
> Thanks Lukas,
>
> I had already removed the second hunk, but I merged read_write.c part
> into my queue for v5.15. It should show up in linux-next soon.

Yeah, I guess the issue on the second hunk caused a compiler warning
(so more obvious) and was reported otherwise; the issue around the
first hunk is only discovered with a bit more involved static
analysis, done by clang-analyzer, coccinelle scripts and friends.

Lukas

      reply	other threads:[~2021-08-24 13:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 11:12 [PATCH] fs: clean up after mandatory file locking support removal Lukas Bulwahn
2021-08-24 11:56 ` Jeff Layton
2021-08-24 13:00   ` Lukas Bulwahn [this message]

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=CAKXUXMz99n0ixBQaM2HJxpHQ9ywYJ-yUAa0+WAmjczGhe4JQRQ@mail.gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).