From b0d0b877e2b2ad6b68e3b68882b28ae65e9175d2 Mon Sep 17 00:00:00 2001 From: Junyeon LEE Date: Tue, 11 Jul 2017 22:17:07 +0900 Subject: [PATCH] kernel/sched: remove maximum boundary check for pid This commit fixes maximum boundary checking in sched_gettcb(). If thread or task was created over 32767, g_lastpid value returns to lower value and it makes wrong comparision in sched_gettcb(). For example) System thread (pid = 32767) was already created and user creates one more thread, then user's pid will be allocated lower than system's thread (1 or above). In this case, not that g_lastpid is same with user's pid, system's pid can not fit below condition. (pid > 0 && pid <= g_lastpid) Change-Id: I9a6d164dd5d7b49e7920e1f597015bd8211b1297 Signed-off-by: Junyeon LEE --- os/kernel/sched/sched_gettcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/kernel/sched/sched_gettcb.c b/os/kernel/sched/sched_gettcb.c index 6e92375..fd21246 100644 --- a/os/kernel/sched/sched_gettcb.c +++ b/os/kernel/sched/sched_gettcb.c @@ -101,7 +101,7 @@ FAR struct tcb_s *sched_gettcb(pid_t pid) /* Verify that the PID is within range */ - if (pid >= 0 && pid <= g_lastpid) { + if (pid >= 0) { /* Get the hash_ndx associated with the pid */ hash_ndx = PIDHASH(pid); -- 2.7.4