Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: Replace kzalloc() + copy_from_user() with memdup_user()

Replace kzalloc() followed by copy_from_user() with memdup_user() to
improve and simplify io_probe().

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Thorsten Blum and committed by
Jens Axboe
7b0604d7 473efbc3

+3 -7
+3 -7
io_uring/register.c
··· 47 47 nr_args = IORING_OP_LAST; 48 48 49 49 size = struct_size(p, ops, nr_args); 50 - p = kzalloc(size, GFP_KERNEL); 51 - if (!p) 52 - return -ENOMEM; 53 - 54 - ret = -EFAULT; 55 - if (copy_from_user(p, arg, size)) 56 - goto out; 50 + p = memdup_user(arg, size); 51 + if (IS_ERR(p)) 52 + return PTR_ERR(p); 57 53 ret = -EINVAL; 58 54 if (memchr_inv(p, 0, size)) 59 55 goto out;