Skip to content

Commit fb6328b

Browse files
committed
io_uring/net: simplify msghd->msg_inq checking
Just check for larger than zero rather than check for non-zero and not -1. This is easier to read, and also protects against any errants < 0 values that aren't -1. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 186daf2 commit fb6328b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io_uring/net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
697697
unsigned int cflags;
698698

699699
cflags = io_put_kbuf(req, issue_flags);
700-
if (msg->msg_inq && msg->msg_inq != -1)
700+
if (msg->msg_inq > 0)
701701
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
702702

703703
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
@@ -720,7 +720,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
720720

721721
io_recv_prep_retry(req);
722722
/* Known not-empty or unknown state, retry */
723-
if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1) {
723+
if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq < 0) {
724724
if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)
725725
return false;
726726
/* mshot retries exceeded, force a requeue */

0 commit comments

Comments
 (0)