[PATCH] i386: additional fix for making ioremap() accept64-bit addresses

From: Jan Beulich
Date: Fri Apr 04 2008 - 08:19:41 EST


The recent change to __ioremap()'s first parameter's type didn't yield
the intended effect as the first conditional inside the function would
still have filtered out any addresses with bits [63:32] set. Correct
last_addr's type and at once also add a check that the address range
doesn't extend into space hardware cannot support even theoretically.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Cc: H. Peter Anvin <hpa@xxxxxxxxxx>
Cc: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

---
arch/x86/mm/ioremap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

--- linux-2.6.25-rc8/arch/x86/mm/ioremap.c 2008-04-02 16:21:19.000000000 +0200
+++ 2.6.25-rc8-i386-ioremap-64bit/arch/x86/mm/ioremap.c 2008-04-02 15:21:42.000000000 +0200
@@ -109,13 +109,14 @@ static int ioremap_change_attr(unsigned
static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
enum ioremap_mode mode)
{
- unsigned long pfn, offset, last_addr, vaddr;
+ unsigned long pfn, offset, vaddr;
+ resource_size_t last_addr;
struct vm_struct *area;
pgprot_t prot;

/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
- if (!size || last_addr < phys_addr)
+ if (!size || last_addr < phys_addr || last_addr > __PHYSICAL_MASK)
return NULL;

/*



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/