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>
This commit is contained in:
Pavel Begunkov 2025-11-10 13:04:51 +00:00 committed by Jens Axboe
parent 7bb21a52e2
commit 01405895c1
1 changed files with 3 additions and 5 deletions

View 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;