lkml.org 
[lkml]   [2022]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
Date
Using vma_lookup() verifies the start is contained in the found vma. This
results in easier to read the code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/mlock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index efd2dd2943de..fefa9644d0f9 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -453,8 +453,8 @@ static int apply_vma_lock_flags(unsigned long start, size_t len,
return -EINVAL;
if (end == start)
return 0;
- vma = find_vma(current->mm, start);
- if (!vma || vma->vm_start > start)
+ vma = vma_lookup(current->mm, start);
+ if (!vma)
return -ENOMEM;

prev = vma->vm_prev;
--
2.23.0
\
 
 \ /
  Last update: 2022-03-14 16:21    [W:0.082 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site