[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200811102848.GN2026@twin.jikos.cz>
Date: Tue, 11 Aug 2020 12:28:48 +0200
From: David Sterba <dsterba@...e.cz>
To: Nikolay Borisov <nborisov@...e.com>
Cc: Pavel Machek <pavel@...x.de>, clm@...com, jbacik@...com,
dsterba@...e.com, sashal@...nel.org, wqu@...e.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
jungyeon@...ech.edu, stable@...nel.org
Subject: Re: [PATCH] btrfs: fix error value in btrfs_get_extent
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@...x.de>
> >
> > Good catch, this also needs:
> >
> > Fixes: 6bf9e4bd6a27 ("btrfs: inode: Verify inode mode to avoid NULL
> > pointer dereference")
> >
> > Reviewed-by: Nikolay Borisov <nborisov@...e.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.
Powered by blists - more mailing lists