From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH RFC 3/7] xen: arm: make sure we stay within the memory bank during mm setup Date: Tue, 17 Sep 2013 02:40:46 +0100 Message-ID: <1379382050-11821-3-git-send-email-ian.campbell@citrix.com> References: <1379381846.11304.73.camel@hastur.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1379381846.11304.73.camel@hastur.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: julien.grall@citrix.com, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Otherwise if there is a module in another bank we can run off the end. Signed-off-by: Ian Campbell --- xen/arch/arm/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index e58dbc6..94b1362 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -223,8 +223,10 @@ static paddr_t __init next_module(paddr_t s, paddr_t *n) continue; if ( mod_s > lowest ) continue; + if ( mod_s > *n ) + continue; lowest = mod_s; - *n = mod_e; + *n = min(*n, mod_e); } return lowest; } @@ -450,6 +452,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; -- 1.8.3.2