mm/mremap:: Use vma_lookup() instead of find_vma()
Subsystems (2)
PATCH 1/1 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 the code.
Signed-off-by Miaohe Lin <[email protected]>
--- mm/mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/mremap.c +2 -2
@@ -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; }
Signature · 1 line
2.23.0
Quoted 13 lines · Miaohe Lin
Using
vma_lookup()verifies the address is contained in the found vma. This results in easier to read the code.Signed-off-by Miaohe Lin <[email protected]>--- mm/mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)mm/mremap.c +0
-0
mm/mremap.c SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, · line 949
Quoted 10 lines
mm/mremap.c +2
-2@@ -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; }
Reviewed-by David Hildenbrand <[email protected]>
Signature · 3 lines
Thanks, David / dhildenb