summaryrefslogtreecommitdiff
path: root/io_uring/kbuf.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-03-13 15:01:03 -0600
committerJens Axboe <axboe@kernel.dk>2024-04-15 08:10:26 -0600
commit18595c0a58ae29ac6a996c5b664610119b73182d (patch)
tree6add63bea7134e2584d1843b3fefbc49440e040e /io_uring/kbuf.c
parent87585b05757dc70545efb434669708d276125559 (diff)
io_uring: use unpin_user_pages() where appropriate
There are a few cases of open-rolled loops around unpin_user_page(), use the generic helper instead. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/kbuf.c')
-rw-r--r--io_uring/kbuf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index 820ac599d003..10d5c98c1c56 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -455,8 +455,8 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg,
struct io_buffer_list *bl)
{
struct io_uring_buf_ring *br = NULL;
- int nr_pages, ret, i;
struct page **pages;
+ int nr_pages, ret;
pages = io_pin_pages(reg->ring_addr,
flex_array_size(br, bufs, reg->ring_entries),
@@ -492,8 +492,7 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg,
bl->is_mmap = 0;
return 0;
error_unpin:
- for (i = 0; i < nr_pages; i++)
- unpin_user_page(pages[i]);
+ unpin_user_pages(pages, nr_pages);
kvfree(pages);
vunmap(br);
return ret;