Skip to contentSkip to conversation

ioapic: remove useless lower bounds check

PATCH In review Paolo Bonzini 2 participants 2 messages Jul 4, 2018 – Jul 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioapic: remove useless lower bounds check

The vector cannot be negative. Coverity now reports this because it sees an array access before the check, in ioapic_stat_update_irq.

---
 hw/intc/ioapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/ioapic.c +1 -1
index b3937807c2..b6896ac4ce 100644
@@ -152,7 +152,7 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
     if (vector == 0) {
         vector = 2;
     }
-    if (vector >= 0 && vector < IOAPIC_NUM_PINS) {
+    if (vector < IOAPIC_NUM_PINS) {
         uint32_t mask = 1 << vector;
         uint64_t entry = s->ioredtbl[vector];
 
Signature · 1 line
2.17.1