arch/powerpc/kvm/book3s: use vma_lookup() in kvmppc_hv_setup_htab_rma()
authorLiam Howlett <liam.howlett@oracle.com>
Tue, 29 Jun 2021 02:39:05 +0000 (19:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:51 +0000 (10:53 -0700)
Using vma_lookup() removes the requirement to check if the address is
within the returned vma.  The code is easier to understand and more
compact.

Link: https://lkml.kernel.org/r/20210521174745.2219620-7-Liam.Howlett@Oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/kvm/book3s_hv.c

index bc08136..fb83c84 100644 (file)
@@ -4758,8 +4758,8 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
        /* Look up the VMA for the start of this memory slot */
        hva = memslot->userspace_addr;
        mmap_read_lock(kvm->mm);
-       vma = find_vma(kvm->mm, hva);
-       if (!vma || vma->vm_start > hva || (vma->vm_flags & VM_IO))
+       vma = vma_lookup(kvm->mm, hva);
+       if (!vma || (vma->vm_flags & VM_IO))
                goto up_out;
 
        psize = vma_kernel_pagesize(vma);