aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:34:06 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:06 -0500
commit266b9f8727976769e2ed2dad77ac9295f37e321e (patch)
treeed022bbf1126c2f09cb99ddfb402ef9e8da07740
parent950f9d95bed1a366434d3597ea75f5b9d772d74f (diff)
x86: fix ioremap RAM check
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/mm/ioremap.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 24e42cab8d58..e84c09e7d2c1 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -125,23 +125,14 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
125 if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS) 125 if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
126 return (__force void __iomem *)phys_to_virt(phys_addr); 126 return (__force void __iomem *)phys_to_virt(phys_addr);
127 127
128#ifdef CONFIG_X86_32
129 /* 128 /*
130 * Don't allow anybody to remap normal RAM that we're using.. 129 * Don't allow anybody to remap normal RAM that we're using..
131 */ 130 */
132 if (phys_addr <= virt_to_phys(high_memory - 1)) { 131 for (offset = phys_addr >> PAGE_SHIFT; offset < max_pfn_mapped &&
133 char *t_addr, *t_end; 132 (offset << PAGE_SHIFT) < last_addr; offset++) {
134 struct page *page; 133 if (page_is_ram(offset))
135 134 return NULL;
136 t_addr = __va(phys_addr);
137 t_end = t_addr + (size - 1);
138
139 for (page = virt_to_page(t_addr);
140 page <= virt_to_page(t_end); page++)
141 if (!PageReserved(page))
142 return NULL;
143 } 135 }
144#endif
145 136
146 pgprot = MAKE_GLOBAL(__PAGE_KERNEL | flags); 137 pgprot = MAKE_GLOBAL(__PAGE_KERNEL | flags);
147 138