public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: io-uring@vger.kernel.org
Subject: Re: [bug report] io_uring/zcrx: add support for multiple ifqs
Date: Wed, 23 Apr 2025 11:30:26 +0100	[thread overview]
Message-ID: <83595e5a-ae53-4ca8-86a9-5909833b77bd@gmail.com> (raw)
In-Reply-To: <6047214a-794f-400b-993c-5b5ef9e6daf6@gmail.com>

On 4/23/25 11:04, Pavel Begunkov wrote:
> On 4/23/25 08:15, Dan Carpenter wrote:
>> Hello Pavel Begunkov,
>>
>> Commit 9c2a1c508442 ("io_uring/zcrx: add support for multiple ifqs")
>> from Apr 20, 2025 (linux-next), leads to the following Smatch static
>> checker warning:
>>
>>     io_uring/zcrx.c:457 io_register_zcrx_ifq()
>>     error: uninitialized symbol 'id'.
>>
>> io_uring/zcrx.c
> ...
>>      396         ifq = io_zcrx_ifq_alloc(ctx);
>>      397         if (!ifq)
>>      398                 return -ENOMEM;
>>      399
>>      400         scoped_guard(mutex, &ctx->mmap_lock) {
>>      401                 /* preallocate id */
>>      402                 ret = xa_alloc(&ctx->zcrx_ctxs, &id, NULL, xa_limit_31b, GFP_KERNEL);
>>      403                 if (ret)
>>      404                         goto err;
>>
>> Potentially uninitialized on this path.  Presumably we don't need to
>> erase id if alloc fails.
> 
> Thanks for letting know

Jens, do you want a separate patch or to fix it up as it's the top
patch? This should do

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 39744302fad1..ac2a05364b24 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -450,7 +450,7 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
  		/* preallocate id */
  		ret = xa_alloc(&ctx->zcrx_ctxs, &id, NULL, xa_limit_31b, GFP_KERNEL);
  		if (ret)
-			goto err;
+			goto ifq_free;
  	}
  
  	ret = io_allocate_rbuf_ring(ifq, &reg, &rd, id);
@@ -506,6 +506,7 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
  err:
  	scoped_guard(mutex, &ctx->mmap_lock)
  		xa_erase(&ctx->zcrx_ctxs, id);
+ifq_free:
  	io_zcrx_ifq_free(ifq);
  	return ret;
  }

-- 
Pavel Begunkov


  reply	other threads:[~2025-04-23 10:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23  7:15 [bug report] io_uring/zcrx: add support for multiple ifqs Dan Carpenter
2025-04-23 10:04 ` Pavel Begunkov
2025-04-23 10:30   ` Pavel Begunkov [this message]
2025-04-23 13:14     ` Jens Axboe
2025-04-23 15:59       ` Pavel Begunkov

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 \
    --in-reply-to=83595e5a-ae53-4ca8-86a9-5909833b77bd@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=io-uring@vger.kernel.org \
    /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