From 01405895c1e7d950964bebc8e4b0fc7aa77de24c Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Mon, 10 Nov 2025 13:04:51 +0000 Subject: [PATCH] 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 Signed-off-by: Jens Axboe --- io_uring/io_uring.c | 8 +++----- 1 file 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 @@ static __cold int io_uring_create(struct io_uring_params *p, 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;