summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-11-10 13:04:51 +0000
committerJens Axboe <axboe@kernel.dk>2025-11-11 07:53:33 -0700
commit01405895c1e7d950964bebc8e4b0fc7aa77de24c (patch)
tree5da20087b3bf9146321f9aef296f50d2dbdcecf9 /io_uring
parent7bb21a52e2d435b9edffe3b40264ab4462e338e0 (diff)
io_uring: use mem_is_zero to check ring params
mem_is_zero() does the job without hand rolled loops, use that to verify reserved fields of ring params. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 023b0e3a829c..af7b4cbe9850 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3684,14 +3684,12 @@ err_fput:
static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
{
struct io_uring_params p;
- int i;
if (copy_from_user(&p, params, sizeof(p)))
return -EFAULT;
- for (i = 0; i < ARRAY_SIZE(p.resv); i++) {
- if (p.resv[i])
- return -EINVAL;
- }
+
+ if (!mem_is_zero(&p.resv, sizeof(p.resv)))
+ return -EINVAL;
if (p.flags & ~IORING_SETUP_FLAGS)
return -EINVAL;