Commit 01405895 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

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: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7bb21a52
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -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])

	if (!mem_is_zero(&p.resv, sizeof(p.resv)))
		return -EINVAL;
	}

	if (p.flags & ~IORING_SETUP_FLAGS)
		return -EINVAL;