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

index 6bbe314c5260373690c4cd20ddca2416c677b415..ced6830d0ff4296cf7489a88ef770eb99fb1230d 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -521,10 +521,8 @@ static struct vm_area_struct *find_mergeable_vma(struct mm_struct *mm,
        struct vm_area_struct *vma;
        if (ksm_test_exit(mm))
                return NULL;
-       vma = find_vma(mm, addr);
-       if (!vma || vma->vm_start > addr)
-               return NULL;
-       if (!(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma)
+       vma = vma_lookup(mm, addr);
+       if (!vma || !(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma)
                return NULL;
        return vma;
 }