linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-mm@kvack.org, akpm@osdl.org
Subject: [PATCH] Fix index calculations in clear_page_range.
Date: Tue, 11 Jan 2005 19:24:11 +0100	[thread overview]
Message-ID: <20050111182411.GA6055@mschwid3.boeblingen.de.ibm.com> (raw)

[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>

                 reply	other threads:[~2005-01-11 18:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050111182411.GA6055@mschwid3.boeblingen.de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox