From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 01/29] xen/arm: lr must be included in range [0-nr_lr[ Date: Mon, 29 Apr 2013 16:13:47 +0100 Message-ID: <517E8E2B.8010709@linaro.org> References: <1367247309.3142.321.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1367247309.3142.321.camel@zakaz.uk.xensource.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: Anthony Perard , "patches@linaro.org" , Stefano Stabellini , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 04/29/2013 03:55 PM, Ian Campbell wrote: > On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote: > > Typo in subject, [ at the end, did you mean ] or ) ? ( I can never > remember which one is inclusive) I mean ). But [ is also accepted even if it's non-standard. http://mathworld.wolfram.com/OpenInterval.html I will fix it. >> Signed-off-by: Julien Grall >> --- >> xen/arch/arm/gic.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c >> index bc8faf2..bac2af2 100644 >> --- a/xen/arch/arm/gic.c >> +++ b/xen/arch/arm/gic.c >> @@ -512,7 +512,9 @@ static inline void gic_set_lr(int lr, unsigned int virtual_irq, >> { >> int maintenance_int = GICH_LR_MAINTENANCE_IRQ; >> >> - BUG_ON(lr > nr_lrs); >> + BUG_ON(lr >= nr_lrs); >> + BUG_ON(lr < 0); > >> + BUG_ON(state & ~(GICH_LR_STATE_MASK< > This suggests that STATE_MASK is inconveniently defined, it'd be more > normal to include the SHIFT in the mask. > > The same is true of all the other GICH_LR_*_MASK/SHIFT defines. The only > one which is used is GICH_LR_VIRTUAL_MASK+SHIFT, and I guess I can see > why in that case. > I think all GICH_LR_*_MASK must be consistent. If we modify GICH_LR_STATE_* we need to modify all the others. This is basically the same for GICH_LR_PRIORITY_MASK/SHIFT but it's seems we don't use the mask. -- Julien