]> git.baikalelectronics.ru Git - kernel.git/commit
mm/mmap.c: logic of find_vma_intersection repeated in __do_munmap
authorGonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
Tue, 29 Jun 2021 02:38:39 +0000 (19:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:50 +0000 (10:53 -0700)
commit7e05d24e862ffc4fa99d7c699508d28aa23ab3a0
tree537708f69ad1f4228d5f4c2ac6551acb5e485dd0
parentedbda3f9dfe3d58cefa3522fe86a0cf73bccc7f7
mm/mmap.c: logic of find_vma_intersection repeated in __do_munmap

Logic of find_vma_intersection() is repeated in __do_munmap().

Also, prev is assigned a value before checking vma->vm_start >= end which
might end up on a return statement making that assignment useless.

Calling find_vma_intersection() checks that condition and returns NULL if
no vma is found, hence only the !vma check is needed in __do_munmap().

Link: https://lkml.kernel.org/r/20210409162129.18313-1-gmjuareztello@gmail.com
Signed-off-by: Gonzalo Matias Juarez Tello <gmjuareztello@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c