Skip to content

Commit

Permalink
io_uring: fix index calculation
Browse files Browse the repository at this point in the history
When indexing into a provided buffer ring, do not subtract 1 from the
index.

Fixes: c7fb194 ("io_uring: add support for ring mapped supplied buffers")
Signed-off-by: Dylan Yudaken <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Hao Xu <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Dylan Yudaken authored and axboe committed Jun 13, 2022
1 parent b13bacc commit 97da4a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,7 @@ static void __user *io_ring_buffer_select(struct io_kiocb *req, size_t *len,
buf = &br->bufs[head];
} else {
int off = head & (IO_BUFFER_LIST_BUF_PER_PAGE - 1);
int index = head / IO_BUFFER_LIST_BUF_PER_PAGE - 1;
int index = head / IO_BUFFER_LIST_BUF_PER_PAGE;
buf = page_address(bl->buf_pages[index]);
buf += off;
}
Expand Down

0 comments on commit 97da4a5

Please sign in to comment.