Skip to content

Commit b65db92

Browse files
committed
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>
1 parent 1ef6663 commit b65db92

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

io_uring/net.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
630630
unsigned int cflags;
631631

632632
cflags = io_put_kbuf(req, issue_flags);
633-
if (msg->msg_inq && msg->msg_inq != -1U)
633+
if (msg->msg_inq && msg->msg_inq != -1)
634634
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
635635

636636
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
@@ -645,7 +645,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
645645
io_recv_prep_retry(req);
646646
/* Known not-empty or unknown state, retry */
647647
if (cflags & IORING_CQE_F_SOCK_NONEMPTY ||
648-
msg->msg_inq == -1U)
648+
msg->msg_inq == -1)
649649
return false;
650650
if (issue_flags & IO_URING_F_MULTISHOT)
651651
*ret = IOU_ISSUE_SKIP_COMPLETE;
@@ -804,7 +804,7 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
804804
flags |= MSG_DONTWAIT;
805805

806806
kmsg->msg.msg_get_inq = 1;
807-
kmsg->msg.msg_inq = -1U;
807+
kmsg->msg.msg_inq = -1;
808808
if (req->flags & REQ_F_APOLL_MULTISHOT) {
809809
ret = io_recvmsg_multishot(sock, sr, kmsg, flags,
810810
&mshot_finished);
@@ -902,7 +902,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
902902
if (unlikely(ret))
903903
goto out_free;
904904

905-
msg.msg_inq = -1U;
905+
msg.msg_inq = -1;
906906
msg.msg_flags = 0;
907907

908908
flags = sr->msg_flags;

0 commit comments

Comments
 (0)