From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Pavel Machek <pavel@denx.de>,
clm@fb.com, jbacik@fb.com, dsterba@suse.com, sashal@kernel.org,
wqu@suse.com, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org, jungyeon@gatech.edu,
stable@kernel.org
Subject: Re: [PATCH] btrfs: fix error value in btrfs_get_extent
Date: Tue, 11 Aug 2020 12:28:48 +0200 [thread overview]
Message-ID: <20200811102848.GN2026@twin.jikos.cz> (raw)
In-Reply-To: <c30a0a5e-dfd5-8bee-63f6-c93af9dc7eb6@suse.com>
On Mon, Aug 03, 2020 at 12:50:31PM +0300, Nikolay Borisov wrote:
> On 3.08.20 г. 12:39 ч., Nikolay Borisov wrote:
> > On 3.08.20 г. 12:35 ч., Pavel Machek wrote:
> >> btrfs_get_extent() sets variable ret, but out: error path expect error
> >> to be in variable err. Fix that.
> >>
> >> Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
> >
> > Good catch, this also needs:
> >
> > Fixes: 6bf9e4bd6a27 ("btrfs: inode: Verify inode mode to avoid NULL
> > pointer dereference")
> >
> > Reviewed-by: Nikolay Borisov <nborisov@suse.com>
>
> Actually the reason this error got introduced in the first place and I
> missed it during the review is that the function is doing something
> rather counter-intuitive - it's using 'err' variable as a synonym for
> 'ret'. A better approach would be to simply remove 'err' from that
> function. I'm now authoring such a patch, nevertheless the issue still
> stands.
The expected pattern is to use 'ret' for function return value and add
other temporary variables instead of the err/ret switching, which can be
found in the oldish code still. So the cleanup is going to do the right
thing, thanks.
next prev parent reply other threads:[~2020-08-11 10:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 9:35 [PATCH] btrfs: fix error value in btrfs_get_extent Pavel Machek
2020-08-03 9:39 ` Nikolay Borisov
2020-08-03 9:50 ` Nikolay Borisov
2020-08-11 10:28 ` David Sterba [this message]
2020-08-11 10:25 ` David Sterba
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=20200811102848.GN2026@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=jbacik@fb.com \
--cc=jungyeon@gatech.edu \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=pavel@denx.de \
--cc=sashal@kernel.org \
--cc=stable@kernel.org \
--cc=wqu@suse.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