You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/10/16 09:19:26 UTC
[incubator-nuttx] 01/02: sched/pidhash: init g_pidhash to NULL to
avoid wild pointer
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 13741c9017bc2884f31c41db18405be271f20d70
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Sep 7 22:54:47 2021 +0800
sched/pidhash: init g_pidhash to NULL to avoid wild pointer
Signed-off-by: chao.an <an...@xiaomi.com>
---
sched/sched/sched_gettcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sched/sched/sched_gettcb.c b/sched/sched/sched_gettcb.c
index 776927d..373e218 100644
--- a/sched/sched/sched_gettcb.c
+++ b/sched/sched/sched_gettcb.c
@@ -76,7 +76,7 @@ FAR struct tcb_s *nxsched_get_tcb(pid_t pid)
/* Verify that the correct TCB was found. */
- if (pid == g_pidhash[hash_ndx].pid)
+ if (g_pidhash && pid == g_pidhash[hash_ndx].pid)
{
/* Return the TCB associated with this pid (if any) */