diff options
author | Miaohe Lin <[email protected]> | 2022-03-22 14:42:41 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2022-03-22 15:57:05 -0700 |
commit | 0e6799db9672dcdc995b0f4bfa5cde4420868c93 (patch) | |
tree | be4e04f5269f4ba0ac104464f6ce9db376a0f0ed | |
parent | 360cd06173d6f139581b6b7cf322f66884860e0f (diff) |
mm/mremap:: use vma_lookup() instead of find_vma()
Using vma_lookup() verifies the address is contained in the found vma.
This results in easier to read code.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Miaohe Lin <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/mremap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 002eec83e91e..9d76da79594d 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -942,8 +942,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, if (mmap_write_lock_killable(current->mm)) return -EINTR; - vma = find_vma(mm, addr); - if (!vma || vma->vm_start > addr) { + vma = vma_lookup(mm, addr); + if (!vma) { ret = EFAULT; goto out; } |