From cd3dff3f2e6bc62001caa128ebe5b4d784b327fa Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Fri, 10 Oct 2014 16:20:56 +0200 Subject: [PATCH] core/msg: add DEVELHELP checks for valid pid --- core/msg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/msg.c b/core/msg.c index 4077712c6e..ec16e94cab 100644 --- a/core/msg.c +++ b/core/msg.c @@ -61,6 +61,12 @@ int msg_send(msg_t *m, kernel_pid_t target_pid, bool block) return msg_send_to_self(m); } +#if DEVELHELP + if (!pid_is_valid(target_pid)) { + DEBUG("msg_send(): target_pid is invalid, continuing anyways\n"); + } +#endif /* DEVELHELP */ + dINT(); tcb_t *target = (tcb_t*) sched_threads[target_pid]; @@ -143,6 +149,12 @@ int msg_send_to_self(msg_t *m) int msg_send_int(msg_t *m, kernel_pid_t target_pid) { +#if DEVELHELP + if (!pid_is_valid(target_pid)) { + DEBUG("msg_send(): target_pid is invalid, continuing anyways\n"); + } +#endif /* DEVELHELP */ + tcb_t *target = (tcb_t *) sched_threads[target_pid]; if (target == NULL) {