]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/memory.c: Use vma_lookup() in __access_remote_vm()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 1 Mar 2021 19:30:38 +0000 (14:30 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 10 May 2021 16:39:28 +0000 (12:39 -0400)
Use vma_lookup() to find the VMA at a specific address.  As vma_lookup()
will return NULL if the address is not within any VMA, the start address
no longer needs to be validated.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/memory.c

index 86ba6c1f68214acc03660a7b3b1335974754a3bd..e3b56903b1117991b7b997dfbd540b74a2061034 100644 (file)
@@ -4954,8 +4954,8 @@ int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf,
                         * Check if this is a VM_IO | VM_PFNMAP VMA, which
                         * we can access using slightly different code.
                         */
-                       vma = find_vma(mm, addr);
-                       if (!vma || vma->vm_start > addr)
+                       vma = vma_lookup(mm, addr);
+                       if (!vma)
                                break;
                        if (vma->vm_ops && vma->vm_ops->access)
                                ret = vma->vm_ops->access(vma, addr, buf,