Skip to contentSkip to conversation

arch/x86/kernel/acpi: check the return value of mp_find_ioapic()

PATCH Superseded Li Zhong 1 participant 1 message Sep 2, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 arch/x86/kernel/acpi: check the return value of mp_find_ioapic()

Check the return value of mp_find_ioapic(), which could be -1. Since ioapic will be used as index in mpc_ioapic_id(), we should check the return value ioapic here.

---
 arch/x86/kernel/acpi/boot.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/acpi/boot.c +4 -0
index 907cc98b1938..687111adfb90 100644
@@ -463,6 +463,10 @@ static void mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
 	mp_irq.srcbus = number;
 	mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
 	ioapic = mp_find_ioapic(gsi);
+	if (ioapic < 0) {
+		pr_warn("Failed to find ioapic for gsi : %u\n", gsi);
+		return;
+	}
 	mp_irq.dstapic = mpc_ioapic_id(ioapic);
 	mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
 
Signature · 1 line
2.25.1