diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-06-27 12:05:01 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-27 16:07:24 -0600 |
commit | b65db9211ecb7f8383e02dcf71b8c1e9c7043a40 (patch) | |
tree | 01893799662e8297a04a676764245e8d1a675818 /io_uring/net.c | |
parent | 1ef6663a587ba3e57dc5065a477db1c64481eedd (diff) | |
download | linux-stable-b65db9211ecb7f8383e02dcf71b8c1e9c7043a40.tar.gz linux-stable-b65db9211ecb7f8383e02dcf71b8c1e9c7043a40.tar.bz2 linux-stable-b65db9211ecb7f8383e02dcf71b8c1e9c7043a40.zip |
io_uring/net: use proper value for msg_inq
struct msghdr->msg_inq is a signed type, yet we attempt to store what
is essentially an unsigned bitmask in there. We only really need to know
if the field was stored or not, but let's use the proper type to avoid
any misunderstandings on what is being attempted here.
Link: https://lore.kernel.org/io-uring/CAHk-=wjKb24aSe6fE4zDH-eh8hr-FB9BbukObUVSMGOrsBHCRQ@mail.gmail.com/
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/net.c')
-rw-r--r-- | io_uring/net.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index a8e303796f16..be2d153e39d2 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -630,7 +630,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, unsigned int cflags; cflags = io_put_kbuf(req, issue_flags); - if (msg->msg_inq && msg->msg_inq != -1U) + if (msg->msg_inq && msg->msg_inq != -1) cflags |= IORING_CQE_F_SOCK_NONEMPTY; if (!(req->flags & REQ_F_APOLL_MULTISHOT)) { @@ -645,7 +645,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, io_recv_prep_retry(req); /* Known not-empty or unknown state, retry */ if (cflags & IORING_CQE_F_SOCK_NONEMPTY || - msg->msg_inq == -1U) + msg->msg_inq == -1) return false; if (issue_flags & IO_URING_F_MULTISHOT) *ret = IOU_ISSUE_SKIP_COMPLETE; @@ -804,7 +804,7 @@ retry_multishot: flags |= MSG_DONTWAIT; kmsg->msg.msg_get_inq = 1; - kmsg->msg.msg_inq = -1U; + kmsg->msg.msg_inq = -1; if (req->flags & REQ_F_APOLL_MULTISHOT) { ret = io_recvmsg_multishot(sock, sr, kmsg, flags, &mshot_finished); @@ -902,7 +902,7 @@ retry_multishot: if (unlikely(ret)) goto out_free; - msg.msg_inq = -1U; + msg.msg_inq = -1; msg.msg_flags = 0; flags = sr->msg_flags; |