drivers/irqchip/irq-mips-cpu.c | 3 +++ 1 file changed, 3 insertions(+)
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@163.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
On Wed, Nov 29 2023 at 20:06, Haoran Liu wrote: The subject line: https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#patch-subject > This patch enhances the mips_cpu_register_ipi_domain function in # git grep 'This patch' Documentation/process/ > drivers/irqchip/irq-mips-cpu.c by adding error handling for the > kzalloc The file name is irrelevant. Please read and follow: https://www.kernel.org/doc/html/latest/process/maintainer-tip.html > call. Previously, the function lacked proper handling for kzalloc > failures, which could lead to potential null pointer dereference issues > under low memory conditions. The value of this "enhancement" is dubious. if that kzalloc() fails then any subsequent allocation will fail too and the machine will crash anyway.
© 2016 - 2025 Red Hat, Inc.