summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-03-02 08:27:03 -0700
committerJens Axboe <axboe@kernel.dk>2020-03-02 08:27:03 -0700
commit0edcef5700fd558d2548532e0e5db26cb74d19ca (patch)
tree062497cc0f62f850feead4bf41522a3e8a3ad5b2
parent8a031500a30416844efdcf3b30e42b7cc1dece5b (diff)
downloadliburing-0edcef5700fd558d2548532e0e5db26cb74d19ca.tar.gz
liburing-0edcef5700fd558d2548532e0e5db26cb74d19ca.tar.bz2
__io_uring_get_cqe: don't subtract negative error from 'submit'
Only subtract if we know it's >= 0. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/queue.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/queue.c b/src/queue.c
index a6376a6..16edd16 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -58,7 +58,8 @@ int __io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr,
wait_nr = 0;
if (ret < 0)
err = -errno;
- submit -= ret;
+ else
+ submit -= ret;
if (cqe)
break;
} while (!err);