Skip to contentSkip to conversation

linux/x86: fix off-by-one error in the pirq range checks

PATCH New Jan Beulich 1 participant 1 message Feb 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86: fix off-by-one error in the pirq range checks

As usual, written and tested on 2.6.27.x and made apply to the 2.6.18 tree without further testing.

arch/i386/kernel/io_apic-xen.c +1 -1
@@ -1233,7 +1233,7 @@ static int __assign_irq_vector(int irq)
 
 	BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
 
-	if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS)
+	if (irq < PIRQ_BASE || irq - PIRQ_BASE >= NR_PIRQS)
 		return -EINVAL;
 
 	spin_lock_irqsave(&vector_lock, flags);
arch/x86_64/kernel/io_apic-xen.c +1 -1
@@ -858,7 +858,7 @@ static int __assign_irq_vector(int irq, 
   
   	BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
 
-	if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS)
+	if (irq < PIRQ_BASE || irq - PIRQ_BASE >= NR_PIRQS)
 		return -EINVAL;
 
 	spin_lock_irqsave(&vector_lock, flags);