You need to sign in or sign up before continuing.
提交 e0a04cff 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

[PATCH] mincore: vma crossing fix

My mincore also forgot about crossing vmas.
Signed-off-by: NNick Piggin <npiggin@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 4a76ef03
......@@ -77,8 +77,16 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag
* PTE array for our address.
*/
nr = PTRS_PER_PTE - ((addr >> PAGE_SHIFT) & (PTRS_PER_PTE-1));
if (nr > pages)
nr = pages;
/*
* Don't overrun this vma
*/
nr = min(nr, (vma->vm_end - addr) >> PAGE_SHIFT);
/*
* Don't return more than the caller asked for
*/
nr = min(nr, pages);
pgd = pgd_offset(vma->vm_mm, addr);
if (pgd_none_or_clear_bad(pgd))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册