From: Dave Hansen 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 Signed-off-by: Andrew Morton --- 25-akpm/arch/i386/mm/ioremap.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff -puN arch/i386/mm/ioremap.c~make-sure-ioremap-only-tests-valid-addresses arch/i386/mm/ioremap.c --- 25/arch/i386/mm/ioremap.c~make-sure-ioremap-only-tests-valid-addresses 2004-12-03 20:13:13.109986784 -0800 +++ 25-akpm/arch/i386/mm/ioremap.c 2004-12-03 20:13:59.172984144 -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; - 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,8 @@ void iounmap(volatile void __iomem *addr return; } - if ((p->flags >> 24) && p->phys_addr + p->size <= virt_to_phys(high_memory)) { + if ((p->flags >> 24) && p->phys_addr + p->size <= + virt_to_phys(high_memory) - 1) { change_page_attr(virt_to_page(__va(p->phys_addr)), p->size >> PAGE_SHIFT, PAGE_KERNEL); _