From: Al Viro <viro@zeniv.linux.org.uk>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: axboe@kernel.dk, zohar@linux.vnet.ibm.com, mcgrof@kernel.org,
keescook@chromium.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] fs: avoid fdput() after failed fdget() in ksys_sync_file_range()
Date: Wed, 13 May 2020 06:46:09 +0100 [thread overview]
Message-ID: <20200513054609.GS23230@ZenIV.linux.org.uk> (raw)
In-Reply-To: <71cc3966f60f884924f9dff8875ed478e858dca1.1589311577.git.skhan@linuxfoundation.org>
On Tue, May 12, 2020 at 01:43:04PM -0600, Shuah Khan wrote:
> @@ -364,15 +364,15 @@ int sync_file_range(struct file *file, loff_t offset, loff_t nbytes,
> int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
> unsigned int flags)
> {
> - int ret;
> - struct fd f;
> + int ret = -EBADF;
> + struct fd f = fdget(fd);
>
> - ret = -EBADF;
> - f = fdget(fd);
> - if (f.file)
> - ret = sync_file_range(f.file, offset, nbytes, flags);
> + if (!f.file)
> + goto out;
>
> + ret = sync_file_range(f.file, offset, nbytes, flags);
> fdput(f);
> +out:
> return ret;
IDGI... What's the point of that goto out, when it leads straight to return?
next prev parent reply other threads:[~2020-05-13 5:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 19:43 [PATCH v2 0/2] fs: avoid fdput() after failed fdget() Shuah Khan
2020-05-12 19:43 ` [PATCH v2 1/2] fs: avoid fdput() after failed fdget() in ksys_sync_file_range() Shuah Khan
2020-05-13 5:46 ` Al Viro [this message]
2020-05-12 19:43 ` [PATCH v2 2/2] fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() Shuah Khan
2020-05-13 5:49 ` Al Viro
2020-05-13 13:13 ` Luis Chamberlain
2020-05-13 14:19 ` Luis Chamberlain
2020-05-22 21:59 ` Scott Branden
2020-05-22 22:14 ` Scott Branden
2020-05-22 22:47 ` Luis Chamberlain
2020-05-13 17:56 ` Shuah Khan
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=20200513054609.GS23230@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=zohar@linux.vnet.ibm.com \
/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).