mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] mincore: vma crossing fix
My mincore also forgot about crossing vmas. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4a76ef036a
commit
e0a04cffa4
1 changed files with 10 additions and 2 deletions
12
mm/mincore.c
12
mm/mincore.c
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue