summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2025-11-03 11:02:54 -0700
committerJens Axboe <axboe@kernel.dk>2025-11-03 11:02:54 -0700
commit3615e3f7947a3c1cb15d362da921ac46d771e02c (patch)
treea28f1abb82e1d59ad8b46c158e4b432f2f671f79
parentadb395c457a6a202240ebbb3255bf41b19d08a0d (diff)
io_uring/rsrc: use get/put_user() for integer copy
It's just getting an integer from userspace, installing a file, then copying the output direct descriptor back. No need to use the full copy_to/from_user() for that. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/rsrc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index d787c16dc1c3..4cc38eb56758 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -454,7 +454,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
return -ENXIO;
for (done = 0; done < up->nr_args; done++) {
- if (copy_from_user(&fd, &fds[done], sizeof(fd))) {
+ if (get_user(fd, &fds[done])) {
ret = -EFAULT;
break;
}
@@ -468,7 +468,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
IORING_FILE_INDEX_ALLOC);
if (ret < 0)
break;
- if (copy_to_user(&fds[done], &ret, sizeof(ret))) {
+ if (put_user(ret, &fds[done])) {
__io_close_fixed(req->ctx, issue_flags, ret);
ret = -EFAULT;
break;