arch/m68k/kernel/sys_m68k: use vma_lookup() in sys_cacheflush()
authorLiam Howlett <liam.howlett@oracle.com>
Tue, 29 Jun 2021 02:39:11 +0000 (19:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:51 +0000 (10:53 -0700)
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.

Link: https://lkml.kernel.org/r/20210521174745.2219620-9-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>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/m68k/kernel/sys_m68k.c

index f55bdcb..bd0274c 100644 (file)
@@ -402,8 +402,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
                 * to this process.
                 */
                mmap_read_lock(current->mm);
-               vma = find_vma(current->mm, addr);
-               if (!vma || addr < vma->vm_start || addr + len > vma->vm_end)
+               vma = vma_lookup(current->mm, addr);
+               if (!vma || addr + len > vma->vm_end)
                        goto out_unlock;
        }