Skip to contentSkip to conversation

i386: more ioapic checks

PATCH New Chuck Ebbert 1 participant 1 message Dec 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: more ioapic checks

Coverity reports apic numbers are being passed to functions without checking to see if they are legal.

(This is Kernel Bugzilla #6188.)

arch/i386/kernel/io_apic.c +6 -2
@@ -2265,13 +2265,17 @@ static inline void __init check_timer(vo
 				clear_IO_APIC_pin(0, pin1);
 			return;
 		}
-		clear_IO_APIC_pin(apic1, pin1);
+		if (apic1 == -1)
+			WARN_ON_ONCE(1);
+		else
+			clear_IO_APIC_pin(apic1, pin1);
+
 		printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
 				"IO-APIC\n");
 	}
 
 	printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... ");
-	if (pin2 != -1) {
+	if (pin2 != -1 && apic2 != -1) {
 		printk("\n..... (found pin %d) ...", pin2);
 		/*
 		 * legacy devices should be connected to IO APIC #0
Signature · 1 line
MBTI: IXTP