From: Andrew Cooper Subject: [PATCH] x86/ioapic: Avoid trying to access the -1th ioapic. Date: Mon, 9 Sep 2013 20:36:26 +0100 Message-ID: <1378755386-18093-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org 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 CC: Keir Fraser CC: Jan Beulich --- xen/arch/x86/io_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 048c61c..5512cd5 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -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); -- 1.7.10.4