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) <pa...@denx.de> > > > > Good catch, this also needs: > > > > Fixes: 6bf9e4bd6a27 ("btrfs: inode: Verify inode mode to avoid NULL > > pointer dereference") > > > > Reviewed-by: Nikolay Borisov <nbori...@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.