]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arch/powerpc/kvm/book3s: use vma_lookup() in kvmppc_hv_setup_htab_rma()
authorLiam Howlett <liam.howlett@oracle.com>
Wed, 2 Jun 2021 03:52:19 +0000 (13:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Jun 2021 03:52:19 +0000 (13:52 +1000)
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: Stephen Rothwell <sfr@canb.auug.org.au>
arch/powerpc/kvm/book3s_hv.c

index 7360350e66fffb7a696f639ba25bbe1b46193a46..faf848fdba65881e71048def6326437e5f7fc85c 100644 (file)
@@ -4759,8 +4759,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);