public inbox for [email protected]
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <[email protected]>
To: Markus Elfring <[email protected]>
Cc: [email protected],  [email protected],
	 Jens Axboe <[email protected]>,
	 Pavel Begunkov <[email protected]>,
	 LKML <[email protected]>
Subject: Re: [PATCH v2 1/2] io_uring: Delete a redundant kfree() call in io_ring_ctx_alloc()
Date: Fri, 12 Jan 2024 11:25:48 -0300	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]> (Markus Elfring's message of "Wed, 10 Jan 2024 21:48:37 +0100")

Markus Elfring <[email protected]> writes:

> From: Markus Elfring <[email protected]>
> Date: Wed, 10 Jan 2024 20:54:43 +0100
>
> Another useful pointer was not reassigned to the data structure member
> “io_bl” by this function implementation.
> Thus omit a redundant call of the function “kfree” at the end.

Perhaps rewrite this to:

ctx->io_bl is initialized later through IORING_OP_PROVIDE_BUFFERS or
IORING_REGISTER_PBUF_RING later on, so there is nothing to free in the
ctx allocation error path.

Other than that, and for this patch only:

Reviewed-by: Gabriel Krisman Bertazi <[email protected]>

thanks,

>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
>
> v2:
> A change request by Gabriel Krisman Bertazi was applied here.
>
>
>  io_uring/io_uring.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 86761ec623f9..c9a63c39cdd0 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -344,7 +344,6 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
>  err:
>  	kfree(ctx->cancel_table.hbs);
>  	kfree(ctx->cancel_table_locked.hbs);
> -	kfree(ctx->io_bl);
>  	xa_destroy(&ctx->io_bl_xa);
>  	kfree(ctx);
>  	return NULL;
> --
> 2.43.0
>

-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2024-01-12 14:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[email protected]>
     [not found] ` <[email protected]>
2024-01-10 11:23   ` io_uring: Fix exception handling in io_ring_ctx_alloc() Markus Elfring
2024-01-10 16:55   ` [cocci] [PATCH] " Gabriel Krisman Bertazi
2024-01-10 20:45     ` [PATCH v2 0/2] io_uring: Adjustments for io_ring_ctx_alloc() Markus Elfring
2024-01-10 20:48       ` [PATCH v2 1/2] io_uring: Delete a redundant kfree() call in io_ring_ctx_alloc() Markus Elfring
2024-01-12 14:25         ` Gabriel Krisman Bertazi [this message]
2024-01-12 16:18           ` Jens Axboe
2024-01-12 17:15             ` Gabriel Krisman Bertazi
2024-01-12 17:50               ` [v2 " Markus Elfring
2024-01-10 20:50       ` [PATCH v2 2/2] io_uring: Improve exception handling " Markus Elfring
2024-01-11 13:23         ` Pavel Begunkov
2024-01-12 14:30         ` Gabriel Krisman Bertazi
2024-01-12 15:00           ` [v2 " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox