From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 3/9] xen: arm: make sure we stay within the memory bank during mm setup Date: Thu, 26 Sep 2013 12:14:34 +0100 Message-ID: <5244171A.1090306@linaro.org> References: <1380192538.29483.63.camel@kazak.uk.xensource.com> <1380192556-30700-3-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1380192556-30700-3-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 09/26/2013 11:49 AM, Ian Campbell wrote: > 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 > --- > v2: Improve commend. s/*n/*end/ > --- > xen/arch/arm/setup.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c > index 5f88076..68f79c4 100644 > --- a/xen/arch/arm/setup.c > +++ b/xen/arch/arm/setup.c > @@ -207,9 +207,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 wihch should be considered s/wihch/which Except this minor typo: Acked-by: Julien Grall > + * and 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; > @@ -224,8 +226,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; > } > @@ -454,6 +458,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; > -- Julien Grall