From d4b67115c6b49f25d5fcf71f18e8cfe16171e001 Mon Sep 17 00:00:00 2001 From: Srikanth Patchava Date: Fri, 17 Apr 2026 13:07:17 -0700 Subject: [PATCH] fix: guard LOG_D against null thread pointer in rt_ipc_list_resume() When rt_susp_list_dequeue() returns RT_NULL (empty suspended list), the LOG_D call dereferences thread->parent.name without a null check, causing a crash in debug builds. --- src/ipc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index 7c52956b1c2..3a26d044be6 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -44,7 +44,7 @@ * 2022-04-08 Stanley Correct descriptions * 2022-10-15 Bernard add nested mutex feature * 2022-10-16 Bernard add prioceiling feature in mutex - * 2023-04-16 Xin-zheqi redesigen queue recv and send function return real message size + * 2023-04-16 Xin-zheqi redesign queue recv and send function return real message size * 2023-09-15 xqyjlj perf rt_hw_interrupt_disable/enable */ @@ -140,7 +140,10 @@ struct rt_thread *rt_susp_list_dequeue(rt_list_t *susp_list, rt_err_t thread_err } rt_sched_unlock(slvl); - LOG_D("resume thread:%s\n", thread->parent.name); + if (thread != RT_NULL) + { + LOG_D("resume thread:%s\n", thread->parent.name); + } return thread; }