diff options
author | Nick Piggin <npiggin@suse.de> | 2007-02-14 06:39:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-15 12:57:03 -0500 |
commit | e0a04cffa4e97e1e53625e40e70895c882e8972f (patch) | |
tree | f76ca38a59f07929ecfbc1caf6609eea67a8854c /mm/mincore.c | |
parent | 4a76ef036ac415c28d1adbaf2b7a74040b84d4c2 (diff) |
[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>
Diffstat (limited to 'mm/mincore.c')
-rw-r--r-- | mm/mincore.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mm/mincore.c b/mm/mincore.c index 9c1d0a426e95..5efe0ded69b1 100644 --- a/mm/mincore.c +++ b/mm/mincore.c | |||
@@ -77,8 +77,16 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag | |||
77 | * PTE array for our address. | 77 | * PTE array for our address. |
78 | */ | 78 | */ |
79 | nr = PTRS_PER_PTE - ((addr >> PAGE_SHIFT) & (PTRS_PER_PTE-1)); | 79 | nr = PTRS_PER_PTE - ((addr >> PAGE_SHIFT) & (PTRS_PER_PTE-1)); |
80 | if (nr > pages) | 80 | |
81 | nr = pages; | 81 | /* |
82 | * Don't overrun this vma | ||
83 | */ | ||
84 | nr = min(nr, (vma->vm_end - addr) >> PAGE_SHIFT); | ||
85 | |||
86 | /* | ||
87 | * Don't return more than the caller asked for | ||
88 | */ | ||
89 | nr = min(nr, pages); | ||
82 | 90 | ||
83 | pgd = pgd_offset(vma->vm_mm, addr); | 91 | pgd = pgd_offset(vma->vm_mm, addr); |
84 | if (pgd_none_or_clear_bad(pgd)) | 92 | if (pgd_none_or_clear_bad(pgd)) |