]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mremap: Use vma_lookup() in vma_to_resize()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 8 Apr 2021 20:26:13 +0000 (16:26 -0400)
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/mremap.c

index 47c255b60150b3121c5957c302afd0051d27e3c1..04143755cd1e340176dc4bf90119f2c4511a8aa7 100644 (file)
@@ -634,10 +634,10 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr,
        unsigned long *p)
 {
        struct mm_struct *mm = current->mm;
-       struct vm_area_struct *vma = find_vma(mm, addr);
+       struct vm_area_struct *vma = vma_lookup(mm, addr);
        unsigned long pgoff;
 
-       if (!vma || vma->vm_start > addr)
+       if (!vma)
                return ERR_PTR(-EFAULT);
 
        /*