diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2005-01-11 01:39:55 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-11 01:39:55 -0800 |
commit | 62d02c401565904f29909e14ea8ad975a3b0242b (patch) | |
tree | 5e97bbb8e21a6b3da37f211b63ecafdbc91ba167 /mm | |
parent | 947282e6fefdfd4db0e01fd22711bb019f65db66 (diff) | |
download | history-62d02c401565904f29909e14ea8ad975a3b0242b.tar.gz |
[PATCH] Fix index calculations in clear_page_range.
pgd_index(end + PGDIR_SIZE - 1) returns 0 if end + PGDIR_SIZE - 1 is beyond
the end of the address space.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index 31451af257dd25..b1494dcfd0631e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -190,10 +190,10 @@ static inline void clear_pgd_range(struct mmu_gather *tlb, pgd_t *pgd, unsigned void clear_page_range(struct mmu_gather *tlb, unsigned long start, unsigned long end) { unsigned long addr = start, next; - unsigned long i, nr = pgd_index(end + PGDIR_SIZE-1) - pgd_index(start); pgd_t * pgd = pgd_offset(tlb->mm, start); + unsigned long i; - for (i = 0; i < nr; i++) { + for (i = pgd_index(start); i <= pgd_index(end-1); i++) { next = (addr + PGDIR_SIZE) & PGDIR_MASK; if (next > end || next <= addr) next = end; |