Skip to content

Commit 9adc666

Browse files
committed
io_uring: correct size of overflow CQE calculation
If a 32b CQE is required, don't double the size of the overflow struct, just add the size of the io_uring_cqe addition that is needed. This avoids allocating too much memory, as the io_overflow_cqe size includes the list member required to queue them too. Fixes: e26dca6 ("io_uring: add support for IORING_SETUP_CQE_MIXED") Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9f5f69d commit 9adc666

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

io_uring/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ static struct io_overflow_cqe *io_alloc_ocqe(struct io_ring_ctx *ctx,
756756

757757
if (cqe->flags & IORING_CQE_F_32 || ctx->flags & IORING_SETUP_CQE32) {
758758
is_cqe32 = true;
759-
ocq_size <<= 1;
759+
ocq_size += sizeof(struct io_uring_cqe);
760760
}
761761

762762
ocqe = kzalloc(ocq_size, gfp | __GFP_ACCOUNT);

0 commit comments

Comments
 (0)