mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
mm/mmap: use find_vma_intersection() in do_mmap() for overlap
Using find_vma_intersection() avoids the need for a temporary variable and makes the code cleaner. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Liam R. Howlett <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
96d990239e
commit
35e43c5ff4
@@ -1457,9 +1457,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
|
||||
return addr;
|
||||
|
||||
if (flags & MAP_FIXED_NOREPLACE) {
|
||||
struct vm_area_struct *vma = find_vma(mm, addr);
|
||||
|
||||
if (vma && vma->vm_start < addr + len)
|
||||
if (find_vma_intersection(mm, addr, addr + len))
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user