kernel/sched: remove maximum boundary check for pid
authorJunyeon LEE <junyeon2.lee@samsung.com>
Tue, 11 Jul 2017 13:17:07 +0000 (22:17 +0900)
committerEunBong Song <eunb.song@samsung.com>
Wed, 30 Aug 2017 04:15:44 +0000 (21:15 -0700)
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 <junyeon2.lee@samsung.com>
os/kernel/sched/sched_gettcb.c

index 6e92375..fd21246 100644 (file)
@@ -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);