diff mbox

[V2,01/33] xen/arm: lr must be included in range [0-nr_lr(

Message ID 20a655a5c38d2ef5aff133d87b00a7f6dd42b4e6.1367979526.git.julien.grall@linaro.org
State Changes Requested, archived
Headers show

Commit Message

Julien Grall May 8, 2013, 2:33 a.m. UTC
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Changes in v2:
   - Typo in the commit message
---
 xen/arch/arm/gic.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 61de230..6d71aae 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<<GICH_LR_STATE_SHIFT));
 
     GICH[GICH_LR + lr] = state |
         maintenance_int |