[PATCH] fs: btrfs: Do not free multi when guaranteed to be NULL

Andrew Goodbody andrew.goodbody at linaro.org
Tue Jul 8 16:32:55 CEST 2025


On 08/07/2025 15:16, Johannes Thumshirn wrote:
> On 08.07.25 13:35, Andrew Goodbody wrote:
>> multi is guaranteed to be NULL in the first two error exit paths so the
>> attempt to free it is not needed. Remove those calls.
>>
>> This issue found by Smatch.
>>
>> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
>> ---
>>    fs/btrfs/volumes.c | 2 --
>>    1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 5726981b19c..71b0b55b9c6 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -972,12 +972,10 @@ int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
>>    again:
>>    	ce = search_cache_extent(&map_tree->cache_tree, logical);
>>    	if (!ce) {
>> -		kfree(multi);
>>    		*length = (u64)-1;
>>    		return -ENOENT;
>>    	}
>>    	if (ce->start > logical) {
>> -		kfree(multi);
>>    		*length = ce->start - logical;
>>    		return -ENOENT;
> 
> What tree are you working against? __btrfs_map_block() is "gone" since
> cd4efd210edf ("btrfs: rename __btrfs_map_block to btrfs_map_block")
> which is more than two years old.

master

https://source.denx.de/u-boot/u-boot/-/blob/master/fs/btrfs/volumes.c?ref_type=heads#L975

I am not seeing the commit you mention in master or -next.

Andrew


More information about the U-Boot mailing list