summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJonathan Austin <Jonathan.Austin@arm.com>2012-08-23 15:02:59 +0200
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-08-25 10:20:40 +0200
commit36418c516b31bff4ff949c7c618430a1a514debe (patch)
treea17ddc5786e7761e0e9bd1668a4e4a6e4b48c8c0 /arch
parentARM: 7503/1: mm: only flush both pmd entries for classic MMU (diff)
downloadlinux-36418c516b31bff4ff949c7c618430a1a514debe.tar.xz
linux-36418c516b31bff4ff949c7c618430a1a514debe.zip
ARM: 7499/1: mm: Fix vmalloc overlap check for !HIGHMEM
With !HIGHMEM, sanity_check_meminfo checks for banks that completely or partially overlap the vmalloc region. The test for partial overlap checks __va(bank->start + bank->size) > vmalloc_min. This is not appropriate if there is a non-linear translation between virtual and physical addresses, as bank->start + bank->size is actually in the bank following the one being interrogated. In most cases, even when using SPARSEMEM, this is not problematic as the subsequent bank will start at a higher va than the one in question. However if the physical to virtual address conversion is not monotonic increasing, the incorrect test could result in a bank not being truncated when it should be. This patch ensures we perform the va-pa conversion on memory from the bank we are interested in, not the following one. Reported-by: ??? (Steve) <zhanzhenbo@gmail.com> Signed-off-by: Jonathan Austin <jonathan.austin@arm.com> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/mmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index eab94bc6f805..c2fa21d0103e 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -961,8 +961,8 @@ void __init sanity_check_meminfo(void)
* Check whether this memory bank would partially overlap
* the vmalloc area.
*/
- if (__va(bank->start + bank->size) > vmalloc_min ||
- __va(bank->start + bank->size) < __va(bank->start)) {
+ if (__va(bank->start + bank->size - 1) >= vmalloc_min ||
+ __va(bank->start + bank->size - 1) <= __va(bank->start)) {
unsigned long newsize = vmalloc_min - __va(bank->start);
printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx "
"to -%.8llx (vmalloc region overlap).\n",