x86/ioapic: avoid trying to access the -1th ioapic

Discovered by Coverity, CID 1055743

Depending on the contents of the mp_irqs/mp_ioapics from the MP table,
find_isa_irq_apic() might return -1, at which point calling
ioapic_read_entry() with it is bad.

In addition to bailing if pin is -1, bail if apic is -1.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2013-09-10 16:40:34 +02:00
1 parent 48d50de8e0
commit ef0ea8c2bb
1 file changed
+1 -1
+1 -1
View File
@@ -1828,7 +1828,7 @@ static void __init unlock_ExtINT_logic(void)
pin = find_isa_irq_pin(8, mp_INT);
apic = find_isa_irq_apic(8, mp_INT);
if (pin == -1)
if ( pin == -1 || apic == -1 )
return;
entry0 = ioapic_read_entry(apic, pin, 0);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.