lkml.org 
[lkml]   [2020]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@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.

\
 
 \ /
  Last update: 2020-08-11 12:30    [W:0.029 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site