public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH 4/6] io_uring/kbuf: don't compute size twice on prep
Date: Tue, 13 May 2025 18:26:49 +0100	[thread overview]
Message-ID: <7c97206561b74fce245cb22449c6082d2e066844.1747150490.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1747150490.git.asml.silence@gmail.com>

The size in prep is calculated by io_provide_buffers_prep(), so remove
the recomputation a few lines after.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/kbuf.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index 406e8a9b42c3..eb666c02f488 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -509,8 +509,6 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
 		return -EOVERFLOW;
 	if (check_add_overflow((unsigned long)p->addr, size, &tmp_check))
 		return -EOVERFLOW;
-
-	size = (unsigned long)p->len * p->nbufs;
 	if (!access_ok(u64_to_user_ptr(p->addr), size))
 		return -EFAULT;
 
-- 
2.49.0


  parent reply	other threads:[~2025-05-13 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 17:26 [PATCH 0/6] provided buffer cleanups Pavel Begunkov
2025-05-13 17:26 ` [PATCH 1/6] io_uring/kbuf: account ring io_buffer_list memory Pavel Begunkov
2025-05-13 20:47   ` Jens Axboe
2025-05-13 17:26 ` [PATCH 2/6] io_uring/kbuf: use mem_is_zero() Pavel Begunkov
2025-05-13 17:26 ` [PATCH 3/6] io_uring/kbuf: drop extra vars in io_register_pbuf_ring Pavel Begunkov
2025-05-13 17:26 ` Pavel Begunkov [this message]
2025-05-13 17:26 ` [PATCH 5/6] io_uring/kbuf: refactor __io_remove_buffers Pavel Begunkov
2025-05-13 17:26 ` [PATCH 6/6] io_uring/kbuf: unify legacy buf provision and removal Pavel Begunkov
2025-05-13 20:47 ` [PATCH 0/6] provided buffer cleanups Jens Axboe

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=7c97206561b74fce245cb22449c6082d2e066844.1747150490.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --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