提交 97955f69 编写于 作者: D Deming Wang 提交者: Andrew Morton

mm/mincore.c: use vma_lookup() instead of find_vma()

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

Link: https://lkml.kernel.org/r/20221007030345.5029-1-wangdeming@inspur.comSigned-off-by: NDeming Wang <wangdeming@inspur.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
上级 6fe7d712
...@@ -190,8 +190,8 @@ static long do_mincore(unsigned long addr, unsigned long pages, unsigned char *v ...@@ -190,8 +190,8 @@ static long do_mincore(unsigned long addr, unsigned long pages, unsigned char *v
unsigned long end; unsigned long end;
int err; int err;
vma = find_vma(current->mm, addr); vma = vma_lookup(current->mm, addr);
if (!vma || addr < vma->vm_start) if (!vma)
return -ENOMEM; return -ENOMEM;
end = min(vma->vm_end, addr + (pages << PAGE_SHIFT)); end = min(vma->vm_end, addr + (pages << PAGE_SHIFT));
if (!can_do_mincore(vma)) { if (!can_do_mincore(vma)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册