All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] arch/x86/kernel/acpi: check the return value of mp_find_ioapic()
@ 2022-09-02  7:50 Li Zhong
  0 siblings, 0 replies; only message in thread
From: Li Zhong @ 2022-09-02  7:50 UTC (permalink / raw)
  To: linux-kernel, linux-pm
  Cc: rafael, len.brown, pavel, tglx, mingo, bp, dave.hansen, x86, hpa,
	Li Zhong

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.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 arch/x86/kernel/acpi/boot.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 907cc98b1938..687111adfb90 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -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);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-02  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02  7:50 [PATCH v1] arch/x86/kernel/acpi: check the return value of mp_find_ioapic() Li Zhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.