diff options
author | Mark Brown <broonie@kernel.org> | 2024-06-03 14:45:04 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-06-03 14:45:04 +0300 |
commit | 4ac0f06ca044e3ca938681a0eeb7d52a68b0b30f (patch) | |
tree | 9433afff899211152ff78ed38f9a70ab2bb497fc /io_uring/memmap.c | |
parent | 34864c05a54d1bc544c8c3939aababbc481d99e3 (diff) | |
parent | c3f38fa61af77b49866b006939479069cd451173 (diff) | |
download | linux-4ac0f06ca044e3ca938681a0eeb7d52a68b0b30f.tar.xz |
ASoC: Merge up fixes
We need this to get the i.MX platforms working in CI again.
Diffstat (limited to 'io_uring/memmap.c')
-rw-r--r-- | io_uring/memmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/io_uring/memmap.c b/io_uring/memmap.c index 4785d6af5fee..a0f32a255fd1 100644 --- a/io_uring/memmap.c +++ b/io_uring/memmap.c @@ -244,6 +244,7 @@ __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma) struct io_ring_ctx *ctx = file->private_data; size_t sz = vma->vm_end - vma->vm_start; long offset = vma->vm_pgoff << PAGE_SHIFT; + unsigned int npages; void *ptr; ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz); @@ -253,8 +254,8 @@ __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma) switch (offset & IORING_OFF_MMAP_MASK) { case IORING_OFF_SQ_RING: case IORING_OFF_CQ_RING: - return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, - ctx->n_ring_pages); + npages = min(ctx->n_ring_pages, (sz + PAGE_SIZE - 1) >> PAGE_SHIFT); + return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, npages); case IORING_OFF_SQES: return io_uring_mmap_pages(ctx, vma, ctx->sqe_pages, ctx->n_sqe_pages); |