aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2013-09-16 17:57:08 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-09-27 16:39:03 +0100
commit7b8fca21dfe5584ec8d4c83c24859b1306328c79 (patch)
treeedb45a73eb4a246795e6ca2c415deaf839fe2632 /xen
parent5fbc4c343e52777e636439e2afcdfb3f100211c3 (diff)
downloadxen-7b8fca21dfe5584ec8d4c83c24859b1306328c79.tar.gz
xen-7b8fca21dfe5584ec8d4c83c24859b1306328c79.tar.bz2
xen-7b8fca21dfe5584ec8d4c83c24859b1306328c79.zip
xen: arm: make sure we stay within the memory bank during mm setup
Otherwise if there is a module in another bank we can run off the end. Rename *n to *end to make it clearer what is happening. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Acked-by: Julien Grall <julien.grall@linaro.org>
Diffstat (limited to 'xen')
-rw-r--r--xen/arch/arm/setup.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 23e9577073..d615b4a401 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -264,9 +264,11 @@ static paddr_t __init consider_modules(paddr_t s, paddr_t e,
* Return the end of the non-module region starting at s. In other
* words return s the start of the next modules after s.
*
- * Also returns the end of that module in *n.
+ * On input *end is the end of the region which should be considered
+ * and it is updated to reflect the end of the module, clipped to the
+ * end of the region if it would run over.
*/
-static paddr_t __init next_module(paddr_t s, paddr_t *n)
+static paddr_t __init next_module(paddr_t s, paddr_t *end)
{
struct dt_module_info *mi = &early_info.modules;
paddr_t lowest = ~(paddr_t)0;
@@ -281,8 +283,10 @@ static paddr_t __init next_module(paddr_t s, paddr_t *n)
continue;
if ( mod_s > lowest )
continue;
+ if ( mod_s > *end )
+ continue;
lowest = mod_s;
- *n = mod_e;
+ *end = min(*end, mod_e);
}
return lowest;
}
@@ -528,6 +532,9 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
e = n = bank_end;
}
+ if ( e > bank_end )
+ e = bank_end;
+
setup_xenheap_mappings(s>>PAGE_SHIFT, (e-s)>>PAGE_SHIFT);
xenheap_mfn_end = e;