Commit 62d02c40 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 947282e6
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment