diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2025-01-28 20:56:13 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-01-28 15:10:40 -0700 |
commit | 2b350f756b7acf84afab31d65ce6e3d496213ae5 (patch) | |
tree | 7f797f34d12ec51f3fbaf30cb47bca6202ffa582 /io_uring | |
parent | fefcb0dcd02fd34f808e91b13ce25f9847e52eb9 (diff) |
io_uring/net: clean io_msg_copy_hdr()
Put msg->msg_iov into a local variable in io_msg_copy_hdr(), it reads
better and clearly shows the used types.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Link: https://lore.kernel.org/r/6a5d4f7a96b10e571d6128be010166b3aaf7afd5.1738087204.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/net.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index e72205802055..dedf274fc049 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -280,11 +280,12 @@ static int io_msg_copy_hdr(struct io_kiocb *req, struct io_async_msghdr *iomsg, ret = -EINVAL; goto ua_end; } else { + struct iovec __user *uiov = msg->msg_iov; + /* we only need the length for provided buffers */ - if (!access_ok(&msg->msg_iov[0].iov_len, sizeof(__kernel_size_t))) + if (!access_ok(&uiov->iov_len, sizeof(uiov->iov_len))) goto ua_end; - unsafe_get_user(iov->iov_len, &msg->msg_iov[0].iov_len, - ua_end); + unsafe_get_user(iov->iov_len, &uiov->iov_len, ua_end); sr->len = iov->iov_len; } ret = 0; |