]> Gentwo Git Trees - linux/.git/commitdiff
io_uring: use mem_is_zero to check ring params
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 10 Nov 2025 13:04:51 +0000 (13:04 +0000)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Nov 2025 14:53:33 +0000 (07:53 -0700)
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>
io_uring/io_uring.c

index 023b0e3a829c6f45d656d4c57af3b8664079b649..af7b4cbe98501e0921f97bae24f9cda1f56de748 100644 (file)
@@ -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;