The patch titled Subject: mm/mmap: use find_vma_intersection() in do_mmap() for overlap has been added to the -mm tree. Its filename is mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Liam Howlett <liam.howlett@xxxxxxxxxx> Subject: 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/20210511014328.2902782-1-Liam.Howlett@xxxxxxxxxx Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/mmap.c~mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap +++ a/mm/mmap.c @@ -1457,9 +1457,7 @@ unsigned long do_mmap(struct file *file, 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; } _ Patches currently in -mm which might be from liam.howlett@xxxxxxxxxx are mm-mmap-introduce-unlock_range-for-code-cleanup.patch mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch