From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] xen: arm: correct off-by-one error in consider_modules Date: Tue, 20 Jan 2015 14:40:46 +0000 Message-ID: <1421764846.10440.272.camel@hellion.org.uk> References: <1419160733-31534-1-git-send-email-ijc@hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1419160733-31534-1-git-send-email-ijc@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@linaro.org, tim@xen.org, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Sun, 2014-12-21 at 11:18 +0000, Ian Campbell wrote: > By iterating up to <= mi->nr_mods we are running off the end of the boot > modules, but more importantly it causes us to then skip the first FDT reserved > region, meaning we might clobber it. > > Signed-off-by: Ian Campbell > --- > For 4.5: I think this bug fix should go in, it fixes a real issue and is low > risk. > > I'll also add to my list of things to consider for backport to 4.4. In 4.4 nr_mods was, confusingly, the index of the highest mod present, not the nr. This changed in e73b7d6619c8 "xen: arm: store per-boot module type instead of relying on index", which is how this off by one came to be. e73b7d6619c8 is not in 4.4, consequently I don't think it would be correct to backport this either. Ian. > --- > xen/arch/arm/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c > index 3991d64..f49569d 100644 > --- a/xen/arch/arm/setup.c > +++ b/xen/arch/arm/setup.c > @@ -286,7 +286,7 @@ static paddr_t __init consider_modules(paddr_t s, paddr_t e, > return 0; > > /* First check the boot modules */ > - for ( i = first_mod; i <= mi->nr_mods; i++ ) > + for ( i = first_mod; i < mi->nr_mods; i++ ) > { > paddr_t mod_s = mi->module[i].start; > paddr_t mod_e = mod_s + mi->module[i].size;