summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-05 12:10:38 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-05 12:10:38 +0200
commit4341012c670df5ad59ab9c7ddf3b56924c8c324a (patch)
treec4063480d6b1312d51677d1ed891169ffaacea53
parent5a89edc318bcf06341ca2855b743615cdfad840a (diff)
thread_info: Fix crash when requesting for thread that never ran
* kern/thread.c (thread_info): Set last_processor to 0 when the thread never ran.
-rw-r--r--kern/thread.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kern/thread.c b/kern/thread.c
index dfc6ff68..903fb559 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1613,10 +1613,11 @@ kern_return_t thread_info(
sched_info->depress_priority = thread->depress_priority;
#if NCPUS > 1
- sched_info->last_processor = thread->last_processor->slot_num;
-#else
- sched_info->last_processor = 0;
+ if (thread->last_processor)
+ sched_info->last_processor = thread->last_processor->slot_num;
+ else
#endif
+ sched_info->last_processor = 0;
thread_unlock(thread);
splx(s);