[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231130040642.36133-1-liuhaoran14@163.com>
Date: Wed, 29 Nov 2023 20:06:42 -0800
From: Haoran Liu <liuhaoran14@....com>
To: tsbogend@...ha.franken.de
Cc: fancer.lancer@...il.com, tglx@...utronix.de,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
Haoran Liu <liuhaoran14@....com>
Subject: [PATCH] [irqchip] mips-cpu: Add error handling in mips_cpu_register_ipi_domain
This patch enhances the mips_cpu_register_ipi_domain function in
drivers/irqchip/irq-mips-cpu.c by adding error handling for the kzalloc
call. Previously, the function lacked proper handling for kzalloc
failures, which could lead to potential null pointer dereference issues
under low memory conditions.
Signed-off-by: Haoran Liu <liuhaoran14@....com>
---
drivers/irqchip/irq-mips-cpu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c
index 0c7ae71a0af0..a8030c2b135c 100644
--- a/drivers/irqchip/irq-mips-cpu.c
+++ b/drivers/irqchip/irq-mips-cpu.c
@@ -238,6 +238,9 @@ static void mips_cpu_register_ipi_domain(struct device_node *of_node)
struct cpu_ipi_domain_state *ipi_domain_state;
ipi_domain_state = kzalloc(sizeof(*ipi_domain_state), GFP_KERNEL);
+ if (!ipi_domain_state)
+ panic("Failed to allocate MIPS CPU IPI domain state");
+
ipi_domain = irq_domain_add_hierarchy(irq_domain,
IRQ_DOMAIN_FLAG_IPI_SINGLE,
2, of_node,
--
2.17.1
Powered by blists - more mailing lists