]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] Fix bounding error in ioremap_pfn()
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sun, 3 Jun 2007 18:26:04 +0000 (19:26 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Jul 2007 10:13:33 +0000 (11:13 +0100)
If size=16M offset=2K then we should map two supersections
rather than just one.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/ioremap.c

index f3ade18862aaa8fd8e63488bc3eee36253c4e0f7..75952779ce1991f68114dcbeef6a188c4c47d027 100644 (file)
@@ -280,7 +280,10 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
        if (!type)
                return NULL;
 
-       size = PAGE_ALIGN(size);
+       /*
+        * Page align the mapping size, taking account of any offset.
+        */
+       size = PAGE_ALIGN(offset + size);
 
        area = get_vm_area(size, VM_IOREMAP);
        if (!area)
@@ -325,11 +328,6 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
        if (!size || last_addr < phys_addr)
                return NULL;
 
-       /*
-        * Page align the mapping size
-        */
-       size = PAGE_ALIGN(last_addr + 1) - phys_addr;
-
        return __arm_ioremap_pfn(pfn, offset, size, mtype);
 }
 EXPORT_SYMBOL(__arm_ioremap);