All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm mailing list <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: remap_pte_range
Date: Tue, 29 Jun 2004 17:17:24 -0700	[thread overview]
Message-ID: <65600000.1088554644@flay> (raw)

I have no idea what remap_pte_range is trying to do here, but what it
is doing makes no sense (to me at least). 

If the pfn is not valid, we CANNOT safely call PageReserved on it - 
the *page returned from pfn_to_page is bullshit, and we crash deref'ing
it.

Perhaps this was what it was trying to do? Not sure.

diff -purN -X /home/mbligh/.diff.exclude virgin/mm/memory.c remap_pte_range/mm/memory.c
--- virgin/mm/memory.c	2004-06-16 10:22:15.000000000 -0700
+++ remap_pte_range/mm/memory.c	2004-06-29 17:15:35.000000000 -0700
@@ -908,7 +908,7 @@ static inline void remap_pte_range(pte_t
 	pfn = phys_addr >> PAGE_SHIFT;
 	do {
 		BUG_ON(!pte_none(*pte));
-		if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn)))
+		if (pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
  			set_pte(pte, pfn_pte(pfn, prot));
 		address += PAGE_SIZE;
 		pfn++;


WARNING: multiple messages have this Message-ID (diff)
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm mailing list <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: remap_pte_range
Date: Tue, 29 Jun 2004 17:17:24 -0700	[thread overview]
Message-ID: <65600000.1088554644@flay> (raw)

I have no idea what remap_pte_range is trying to do here, but what it
is doing makes no sense (to me at least). 

If the pfn is not valid, we CANNOT safely call PageReserved on it - 
the *page returned from pfn_to_page is bullshit, and we crash deref'ing
it.

Perhaps this was what it was trying to do? Not sure.

diff -purN -X /home/mbligh/.diff.exclude virgin/mm/memory.c remap_pte_range/mm/memory.c
--- virgin/mm/memory.c	2004-06-16 10:22:15.000000000 -0700
+++ remap_pte_range/mm/memory.c	2004-06-29 17:15:35.000000000 -0700
@@ -908,7 +908,7 @@ static inline void remap_pte_range(pte_t
 	pfn = phys_addr >> PAGE_SHIFT;
 	do {
 		BUG_ON(!pte_none(*pte));
-		if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn)))
+		if (pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
  			set_pte(pte, pfn_pte(pfn, prot));
 		address += PAGE_SIZE;
 		pfn++;

--
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:[~2004-06-30  0:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30  0:17 Martin J. Bligh [this message]
2004-06-30  0:17 ` remap_pte_range Martin J. Bligh
2004-06-30  0:30 ` remap_pte_range Andrew Morton
2004-06-30  0:30   ` remap_pte_range Andrew Morton
2004-06-30  6:44   ` remap_pte_range Martin J. Bligh
2004-06-30  6:44     ` remap_pte_range Martin J. Bligh

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=65600000.1088554644@flay \
    --to=mbligh@aracnet.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.