]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86, early_ioremap: fix fencepost error
authorAlan Cox <alan@redhat.com>
Fri, 10 Oct 2008 09:46:45 +0000 (10:46 +0100)
committerIngo Molnar <mingo@elte.hu>
Sun, 12 Oct 2008 09:19:04 +0000 (11:19 +0200)
The x86 implementation of early_ioremap has an off by one error. If we get
an object which ends on the first byte of a page we undermap by one page and
this causes a crash on boot with the ASUS P5QL whose DMI table happens to fit
this alignment.

The size computation is currently

last_addr = phys_addr + size - 1;
npages = (PAGE_ALIGN(last_addr) - phys_addr)

(Consider a request for 1 byte at alignment 0...)

Closes #11693

Debugging work by Ian Campbell/Felix Geyer

Signed-off-by: Alan Cox <alan@rehat.com>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/ioremap.c

index 6ab3196d12b412979cbfba55467968b513670a49..10b52309aefd37634f87167f52fd8660fac26394 100644 (file)
@@ -614,7 +614,7 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
         */
        offset = phys_addr & ~PAGE_MASK;
        phys_addr &= PAGE_MASK;
-       size = PAGE_ALIGN(last_addr) - phys_addr;
+       size = PAGE_ALIGN(last_addr + 1) - phys_addr;
 
        /*
         * Mappings have to fit in the FIX_BTMAP area.