[tip: irq/urgent] genirq/irq_sim: Initialize work context pointers properly

tip-bot2 for Gyeyoung Baek posted 1 patch 3 months, 4 weeks ago
kernel/irq/irq_sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[tip: irq/urgent] genirq/irq_sim: Initialize work context pointers properly
Posted by tip-bot2 for Gyeyoung Baek 3 months, 4 weeks ago
The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     8a2277a3c9e4cc5398f80821afe7ecbe9bdf2819
Gitweb:        https://git.kernel.org/tip/8a2277a3c9e4cc5398f80821afe7ecbe9bdf2819
Author:        Gyeyoung Baek <gye976@gmail.com>
AuthorDate:    Thu, 12 Jun 2025 21:48:27 +09:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 13 Jun 2025 15:36:35 +02:00

genirq/irq_sim: Initialize work context pointers properly

Initialize `ops` member's pointers properly by using kzalloc() instead of
kmalloc() when allocating the simulation work context. Otherwise the
pointers contain random content leading to invalid dereferencing.

Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250612124827.63259-1-gye976@gmail.com
---
 kernel/irq/irq_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index 1a3d483..ae4c9cb 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -202,7 +202,7 @@ struct irq_domain *irq_domain_create_sim_full(struct fwnode_handle *fwnode,
 					      void *data)
 {
 	struct irq_sim_work_ctx *work_ctx __free(kfree) =
-				kmalloc(sizeof(*work_ctx), GFP_KERNEL);
+				kzalloc(sizeof(*work_ctx), GFP_KERNEL);
 
 	if (!work_ctx)
 		return ERR_PTR(-ENOMEM);