> + if (uaddr < vma->vm_start) {
> + u64 gap = vma->vm_start - uaddr;
> +
> + if (gap >= size)
> + break;
So if the whole request sits in a hole we just bail out and return 0
with nothing mapped? Userspace has no way to know. Same with a hole in
the middle, it quietly ends up with a sparse mapping.
A hole here just means userspace gave us an address with nothing
behind it. Why not just use vma_lookup() instead and fail it?
- vma = find_vma(dev->mm, uaddr);
+ vma = vma_lookup(dev->mm, uaddr);
That also gets rid of the "depends on what's mapped above" thing
sashiko pointed out, and it's what the PA path does anyway,
pin_user_pages() just fails there.