From: Dave Hansen <haveblue@us.ibm.com>
To: akpm@osdl.org
Cc: linux-mm@kvack.org, Dave Hansen <haveblue@us.ibm.com>
Subject: [patch] make sure ioremap only tests valid addresses
Date: Wed, 17 Nov 2004 13:58:23 -0800 [thread overview]
Message-ID: <E1CUXom-0008K5-00@kernel.beaverton.ibm.com> (raw)
When CONFIG_HIGHMEM=y, but ZONE_NORMAL isn't quite full, there is, of course,
no actual memory at *high_memory. This isn't a problem with normal
virt<->phys translations because it's never dereferenced, but CONFIG_NONLINEAR
is a bit more finicky. So, don't do virt_to_phys() to non-existent addresses.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---
memhotplug-dave/arch/i386/mm/ioremap.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff -puN arch/i386/mm/ioremap.c~A2-ioremap-valid-pfns arch/i386/mm/ioremap.c
--- memhotplug/arch/i386/mm/ioremap.c~A2-ioremap-valid-pfns 2004-11-17 13:23:28.000000000 -0800
+++ memhotplug-dave/arch/i386/mm/ioremap.c 2004-11-17 13:23:37.000000000 -0800
@@ -130,7 +130,7 @@ void __iomem * __ioremap(unsigned long p
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
- if (phys_addr < virt_to_phys(high_memory)) {
+ if (phys_addr <= virt_to_phys(high_memory-1)) {
char *t_addr, *t_end;
struct page *page;
@@ -197,7 +197,7 @@ void __iomem *ioremap_nocache (unsigned
/* Guaranteed to be > phys_addr, as per __ioremap() */
last_addr = phys_addr + size - 1;
- if (last_addr < virt_to_phys(high_memory)) {
+ if (last_addr <= virt_to_phys(high_memory-1)) {
struct page *ppage = virt_to_page(__va(phys_addr));
unsigned long npages;
@@ -232,7 +232,7 @@ void iounmap(volatile void __iomem *addr
return;
}
- if (p->flags && p->phys_addr < virt_to_phys(high_memory)) {
+ if (p->flags && p->phys_addr <= virt_to_phys(high_memory-1)) {
change_page_attr(virt_to_page(__va(p->phys_addr)),
p->size >> PAGE_SHIFT,
PAGE_KERNEL);
_
--
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-11-17 21:58 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=E1CUXom-0008K5-00@kernel.beaverton.ibm.com \
--to=haveblue@us.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