diff options
| author | Gabriel Krisman Bertazi <krisman@suse.de> | 2026-08-12 20:40:20 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-08-15 17:25:33 -0600 |
| commit | 0ca89205857c43e02cea3ee2a342e7d3c0c8a421 (patch) | |
| tree | fa599b09b38c4ea4e720cce6ef8d622b21478372 | |
| parent | cd305ee3633a45fcf5f3a5d83f99f3cb77d87b6e (diff) | |
io_uring/rw: Drop custom iov copy in io_iov_buffer_select_prep
Similar to commit f4eaf8eda89e ("io_uring/rsrc: Drop io_copy_iov in
favor of iovec API"), avoid custom copy and just rely on the iovec api.
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
Link: https://patch.msgid.link/20260813004022.3514537-2-krisman@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | io_uring/rw.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index 63b6519e498c..b0ddc9fa36af 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -9,7 +9,6 @@ #include <linux/fsnotify.h> #include <linux/poll.h> #include <linux/nospec.h> -#include <linux/compat.h> #include <linux/io_uring/cmd.h> #include <linux/indirect_call_wrapper.h> @@ -50,33 +49,20 @@ static bool io_file_supports_nowait(struct io_kiocb *req, __poll_t mask) return false; } -static int io_iov_compat_buffer_select_prep(struct io_rw *rw) -{ - struct compat_iovec __user *uiov = u64_to_user_ptr(rw->addr); - struct compat_iovec iov; - - if (copy_from_user(&iov, uiov, sizeof(iov))) - return -EFAULT; - rw->len = iov.iov_len; - return 0; -} - static int io_iov_buffer_select_prep(struct io_kiocb *req) { struct iovec __user *uiov; - struct iovec iov; + struct iovec fast_iov, *iov; struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); if (rw->len != 1) return -EINVAL; - if (io_is_compat(req->ctx)) - return io_iov_compat_buffer_select_prep(rw); - uiov = u64_to_user_ptr(rw->addr); - if (copy_from_user(&iov, uiov, sizeof(*uiov))) - return -EFAULT; - rw->len = iov.iov_len; + iov = iovec_from_user(uiov, 1, 1, &fast_iov, io_is_compat(req->ctx)); + if (IS_ERR(iov)) + return PTR_ERR(iov); + rw->len = iov->iov_len; return 0; } |
