summaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmap.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-03-12 17:03:48 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-03-12 23:09:09 +0000
commit1522ac3ec95ff0230e7aa516f86b674fdf72866c (patch)
tree77444039536e70b3e9fbb38f686104cb5054aba3 /arch/arm/mm/mmap.c
parent305b07680f6c6a7e59f996c5bd85f009caff5bb1 (diff)
downloadlinux-1522ac3ec95ff0230e7aa516f86b674fdf72866c.tar.bz2
[ARM] Fix virtual to physical translation macro corner cases
The current use of these macros works well when the conversion is entirely linear. In this case, we can be assured that the following holds true: __va(p + s) - s = __va(p) However, this is not always the case, especially when there is a non-linear conversion (eg, when there is a 3.5GB hole in memory.) In this case, if 's' is the size of the region (eg, PAGE_SIZE) and 'p' is the final page, the above is most definitely not true. So, we must ensure that __va() and __pa() are only used with valid kernel direct mapped RAM addresses. This patch tweaks the code to achieve this. Tested-by: Charles Moschel <fred99@carolina.rr.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmap.c')
-rw-r--r--arch/arm/mm/mmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 5358fcc7f61e..f7457fea6de8 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -124,7 +124,7 @@ int valid_phys_addr_range(unsigned long addr, size_t size)
{
if (addr < PHYS_OFFSET)
return 0;
- if (addr + size > __pa(high_memory))
+ if (addr + size >= __pa(high_memory - 1))
return 0;
return 1;