diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-04-11 01:46:30 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-11 19:30:41 -0600 |
commit | 4af3417a347d06c8632346a6a9035c28b1dd94b4 (patch) | |
tree | 46407f67af39d93a87800a98d6373b609c73a431 /fs/io_uring.c | |
parent | 0bdf3398b06ef1082b7d796039d34fc61a1285ea (diff) | |
download | lwn-4af3417a347d06c8632346a6a9035c28b1dd94b4.tar.gz lwn-4af3417a347d06c8632346a6a9035c28b1dd94b4.zip |
io_uring: refactor compat_msghdr import
Add an entry for user pointer to compat_msghdr into io_connect, so it's
explicit that we may use it as this, and removes annoying casts.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/73fd644dea1518f528d3648981cf777ce6e537e9.1618101759.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 9aaf3233961e..1779306c50d2 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -570,8 +570,9 @@ struct io_connect { struct io_sr_msg { struct file *file; union { - struct user_msghdr __user *umsg; - void __user *buf; + struct compat_msghdr __user *umsg_compat; + struct user_msghdr __user *umsg; + void __user *buf; }; int msg_flags; int bgid; @@ -4435,16 +4436,14 @@ static int __io_recvmsg_copy_hdr(struct io_kiocb *req, static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req, struct io_async_msghdr *iomsg) { - struct compat_msghdr __user *msg_compat; struct io_sr_msg *sr = &req->sr_msg; struct compat_iovec __user *uiov; compat_uptr_t ptr; compat_size_t len; int ret; - msg_compat = (struct compat_msghdr __user *) sr->umsg; - ret = __get_compat_msghdr(&iomsg->msg, msg_compat, &iomsg->uaddr, - &ptr, &len); + ret = __get_compat_msghdr(&iomsg->msg, sr->umsg_compat, &iomsg->uaddr, + &ptr, &len); if (ret) return ret; |