aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-06-13 08:07:03 -0600
committerJens Axboe <axboe@kernel.dk>2022-06-13 08:07:03 -0600
commitd6f9e02f9c6a777010824341f14c994b11dfc8b1 (patch)
tree634c2611f2aff9c7c4214c06dbd10dd6dcba91d2
parent6387bf35eaf43cfe6865b924f94120fca13e8708 (diff)
downloadliburing-d6f9e02f9c6a777010824341f14c994b11dfc8b1.tar.gz
test/buf-ring: ensure cqe isn't used uninitialized
Fixes: 01e0120220e4 ("buf-ring: add tests that cycle through the provided buffer ring") Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/buf-ring.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/buf-ring.c b/test/buf-ring.c
index 2fcc360..af1cac8 100644
--- a/test/buf-ring.c
+++ b/test/buf-ring.c
@@ -234,22 +234,19 @@ static int test_one_nop(int bgid, struct io_uring *ring)
ret = -1;
goto out;
}
+ ret = cqe->res;
+ io_uring_cqe_seen(ring, cqe);
- if (cqe->res == -ENOBUFS) {
- ret = cqe->res;
- goto out;
- }
+ if (ret == -ENOBUFS)
+ return ret;
- if (cqe->res != 0) {
+ if (ret != 0) {
fprintf(stderr, "nop result %d\n", ret);
- ret = -1;
- goto out;
+ return -1;
}
ret = cqe->flags >> 16;
-
out:
- io_uring_cqe_seen(ring, cqe);
return ret;
}