Skip to content

Commit 0140589

Browse files
isilenceaxboe
authored andcommitted
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>
1 parent 7bb21a5 commit 0140589

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

io_uring/io_uring.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,14 +3684,12 @@ static __cold int io_uring_create(struct io_uring_params *p,
36843684
static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
36853685
{
36863686
struct io_uring_params p;
3687-
int i;
36883687

36893688
if (copy_from_user(&p, params, sizeof(p)))
36903689
return -EFAULT;
3691-
for (i = 0; i < ARRAY_SIZE(p.resv); i++) {
3692-
if (p.resv[i])
3693-
return -EINVAL;
3694-
}
3690+
3691+
if (!mem_is_zero(&p.resv, sizeof(p.resv)))
3692+
return -EINVAL;
36953693

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

0 commit comments

Comments
 (0)