LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] remap_file_pages: Use vma_lookup() instead of find_vma()
@ 2021-08-17 13:52 Liam Howlett
  2021-08-17 14:03 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Howlett @ 2021-08-17 13:52 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Andrew Morton

From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>

Using vma_lookup() verifies the start address is contained in the found vma.
This results in easier to read code.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 mm/mmap.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index d9aa54be6244..1a23d4575cc4 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2994,14 +2994,11 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 	if (mmap_write_lock_killable(mm))
 		return -EINTR;
 
-	vma = find_vma(mm, start);
+	vma = vma_lookup(mm, start);
 
 	if (!vma || !(vma->vm_flags & VM_SHARED))
 		goto out;
 
-	if (start < vma->vm_start)
-		goto out;
-
 	if (start + size > vma->vm_end) {
 		struct vm_area_struct *next;
 
-- 
2.30.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] remap_file_pages: Use vma_lookup() instead of find_vma()
  2021-08-17 13:52 [PATCH] remap_file_pages: Use vma_lookup() instead of find_vma() Liam Howlett
@ 2021-08-17 14:03 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2021-08-17 14:03 UTC (permalink / raw)
  To: Liam Howlett, linux-mm, linux-kernel, Andrew Morton

On 17.08.21 15:52, Liam Howlett wrote:
> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
> 
> Using vma_lookup() verifies the start address is contained in the found vma.
> This results in easier to read code.
> 
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
>   mm/mmap.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d9aa54be6244..1a23d4575cc4 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2994,14 +2994,11 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
>   	if (mmap_write_lock_killable(mm))
>   		return -EINTR;
>   
> -	vma = find_vma(mm, start);
> +	vma = vma_lookup(mm, start);
>   
>   	if (!vma || !(vma->vm_flags & VM_SHARED))
>   		goto out;
>   
> -	if (start < vma->vm_start)
> -		goto out;
> -
>   	if (start + size > vma->vm_end) {
>   		struct vm_area_struct *next;
>   
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-17 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 13:52 [PATCH] remap_file_pages: Use vma_lookup() instead of find_vma() Liam Howlett
2021-08-17 14:03 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).