Re: [cocci] [PATCH] io_uring: Fix exception handling in io_ring_ctx_alloc()

From: Gabriel Krisman Bertazi
Date: Wed Jan 10 2024 - 11:56:13 EST


Markus Elfring <Markus.Elfring@xxxxxx> writes:

> Date: Wed, 29 Mar 2023 17:35:16 +0200
>
> The label “err” was used to jump to a kfree() call despite of
> the detail in the implementation of the function “io_ring_ctx_alloc”
> that it was determined already that a corresponding variable contained
> a null pointer because of a failed memory allocation.
>
> 1. Thus use more appropriate labels instead.
>
> 2. Reorder jump targets at the end.

FWIW, I don't think it makes sense to have the extra labels or re-sort
without a good reason. kfree works fine with the NULL pointers, so there
is no bug to be fixed and moving code around for no reason just makes
life painful for backporters.

Also, the patch no longer applies.

> 3. Omit the statement “kfree(ctx->io_bl);”.

>From a quick look, this might still make sense. can you confirm and make
that change into a separate patch?

--
Gabriel Krisman Bertazi