mirror of https://github.com/torvalds/linux.git
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:
parent
7bb21a52e2
commit
01405895c1
|
|
@ -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)
|
static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
|
||||||
{
|
{
|
||||||
struct io_uring_params p;
|
struct io_uring_params p;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (copy_from_user(&p, params, sizeof(p)))
|
if (copy_from_user(&p, params, sizeof(p)))
|
||||||
return -EFAULT;
|
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;
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
if (p.flags & ~IORING_SETUP_FLAGS)
|
if (p.flags & ~IORING_SETUP_FLAGS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue