aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-14 12:40:53 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-14 12:40:53 +0300
commitcc736811b95483b9e3c3ef03d58932716ae453e7 (patch)
tree618706d44bf8aa19da1f54d30bef229bfa50b24c
parent0c6ba17b2f08d05195cdbaeba4607fdd8d000775 (diff)
downloadkmi-cc736811b95483b9e3c3ef03d58932716ae453e7.tar.gz
kmi-cc736811b95483b9e3c3ef03d58932716ae453e7.zip
add more checks to getting tcb
-rw-r--r--src/tcb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tcb.c b/src/tcb.c
index 48f1d3b..506b756 100644
--- a/src/tcb.c
+++ b/src/tcb.c
@@ -369,7 +369,14 @@ struct tcb *get_tcb(id_t tid)
if (tid <= 0)
return NULL;
- return tcbs[tid & (num_tids - 1)];
+ struct tcb *t = tcbs[tid & (num_tids - 1)];
+ if (!t)
+ return NULL;
+
+ if (t->tid != tid)
+ return NULL;
+
+ return t;
}
void set_return(struct tcb *t, vm_t v)