Skip to content

Commit ddd2297

Browse files
committed
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.
1 parent 96c0ce2 commit ddd2297

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/ipc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* 2022-04-08 Stanley Correct descriptions
4545
* 2022-10-15 Bernard add nested mutex feature
4646
* 2022-10-16 Bernard add prioceiling feature in mutex
47-
* 2023-04-16 Xin-zheqi redesigen queue recv and send function return real message size
47+
* 2023-04-16 Xin-zheqi redesign queue recv and send function return real message size
4848
* 2023-09-15 xqyjlj perf rt_hw_interrupt_disable/enable
4949
*/
5050

@@ -140,7 +140,10 @@ struct rt_thread *rt_susp_list_dequeue(rt_list_t *susp_list, rt_err_t thread_err
140140
}
141141
rt_sched_unlock(slvl);
142142

143-
LOG_D("resume thread:%s\n", thread->parent.name);
143+
if (thread != RT_NULL)
144+
{
145+
LOG_D("resume thread:%s\n", thread->parent.name);
146+
}
144147

145148
return thread;
146149
}

0 commit comments

Comments
 (0)