Re: [PATCH] io_uring/net: Remove unneeded if check in io_net_vec_assign()

From: Thorsten Blum
Date: Sun Aug 11 2024 - 18:37:30 EST


On 12. Aug 2024, at 00:31, Jens Axboe <axboe@xxxxxxxxx> wrote:
> On 8/11/24 4:26 PM, Thorsten Blum wrote:
>> kfree() already checks if its argument is NULL. Remove the unneeded if
>> check and fix the following Coccinelle/coccicheck warning reported by
>> ifnullfree.cocci:
>>
>> WARNING: NULL check before some freeing functions is not needed
>
> Yes it's not needed, but the NULL check is done after a function call.
> For the hot path, it's FASTER to check if it's NULL or not.
>
> I can put a comment on these, but honestly I wish the ifnullfree
> thing would just go away as it's hardly useful for anything. It's
> not like it's a bug to check for NULL first, or that it would find
> something useful.

Ok, thanks for explaining.