Commit 9b2354cf authored by Lothar Wassmann's avatar Lothar Wassmann Committed by Russell King

[ARM PATCH] 2395/1: __ioremap() miscalculates mapping size under certain conditions

Patch from Lothar Wassmann

Hi,
ioremapping a memory range that ends on the first byte of a page
(e.g. mapping PAGE_SIZE + 1 bytes on a page boundary) results in a
mapping that is one page too short. In particular trying to create a 1
byte mapping at the start of a page results in a BUG_ON() assertion in
remap_area_pages() because the calculated mapping size is zero.
This bug has been reported on Bugzilla on 2004-02-25:
http://bugzilla.kernel.org/show_bug.cgi?id=2188

Signed-off-by: Lothar Wassmann
Signed-off-by: Russell King
parent c4366122
......@@ -148,7 +148,7 @@ __ioremap(unsigned long phys_addr, size_t size, unsigned long flags,
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr) - phys_addr;
size = PAGE_ALIGN(last_addr + 1) - phys_addr;
/*
* Ok, go for it..
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment