arch/mips/kernel/traps: use vma_lookup() instead of find_vma()
authorLiam Howlett <liam.howlett@oracle.com>
Tue, 29 Jun 2021 02:39:08 +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-8-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>
Cc: 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/mips/kernel/traps.c

index 0b4e06303c55b5f84b5a4bd8488285790a2bb1dc..6f07362de5cec29d1d9d4870ec23da84a854748d 100644 (file)
@@ -784,7 +784,6 @@ void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
 int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
 {
        int si_code;
-       struct vm_area_struct *vma;
 
        switch (sig) {
        case 0:
@@ -800,8 +799,7 @@ int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
 
        case SIGSEGV:
                mmap_read_lock(current->mm);
-               vma = find_vma(current->mm, (unsigned long)fault_addr);
-               if (vma && (vma->vm_start <= (unsigned long)fault_addr))
+               if (vma_lookup(current->mm, (unsigned long)fault_addr))
                        si_code = SEGV_ACCERR;
                else
                        si_code = SEGV_MAPERR;