]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
lib/test_hmm: Use vma_lookup() in dmirror_migrate()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 8 Apr 2021 20:20:21 +0000 (16:20 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 15 Apr 2021 14:37:32 +0000 (10:37 -0400)
vma_lookup() will only return the vma which contains the address and
will not return the next vma.  This allows the code to easier to
understand.

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

index 80a78877bd939714ab56d9a155b1e490e915548f..15f2e2db77bc3f122ebd48cff805bb5f39550506 100644 (file)
@@ -686,9 +686,8 @@ static int dmirror_migrate(struct dmirror *dmirror,
 
        mmap_read_lock(mm);
        for (addr = start; addr < end; addr = next) {
-               vma = find_vma(mm, addr);
-               if (!vma || addr < vma->vm_start ||
-                   !(vma->vm_flags & VM_READ)) {
+               vma = vma_lookup(mm, addr);
+               if (!vma || !(vma->vm_flags & VM_READ)) {
                        ret = -EINVAL;
                        goto out;
                }