linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix index calculations in clear_page_range.
@ 2005-01-11 18:24 Martin Schwidefsky
  0 siblings, 0 replies; only message in thread
From: Martin Schwidefsky @ 2005-01-11 18:24 UTC (permalink / raw)
  To: linux-mm, akpm

[PATCH] Fix index calculations in clear_page_range.

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

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>

diffstat:
 mm/memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -urN linux-2.6/mm/memory.c linux-2.6-patched/mm/memory.c
--- linux-2.6/mm/memory.c	2005-01-11 19:10:54.000000000 +0100
+++ linux-2.6-patched/mm/memory.c	2005-01-11 19:11:01.000000000 +0100
@@ -190,10 +190,10 @@
 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;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-11 18:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-11 18:24 [PATCH] Fix index calculations in clear_page_range Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox