Skip to content

Commit 2b350f7

Browse files
isilenceaxboe
authored andcommitted
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>
1 parent fefcb0d commit 2b350f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

io_uring/net.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ static int io_msg_copy_hdr(struct io_kiocb *req, struct io_async_msghdr *iomsg,
280280
ret = -EINVAL;
281281
goto ua_end;
282282
} else {
283+
struct iovec __user *uiov = msg->msg_iov;
284+
283285
/* we only need the length for provided buffers */
284-
if (!access_ok(&msg->msg_iov[0].iov_len, sizeof(__kernel_size_t)))
286+
if (!access_ok(&uiov->iov_len, sizeof(uiov->iov_len)))
285287
goto ua_end;
286-
unsafe_get_user(iov->iov_len, &msg->msg_iov[0].iov_len,
287-
ua_end);
288+
unsafe_get_user(iov->iov_len, &uiov->iov_len, ua_end);
288289
sr->len = iov->iov_len;
289290
}
290291
ret = 0;

0 commit comments

Comments
 (0)