schedule: fix null pointer dereferences

Change-Id: I1d4b0a2fabb5810a89cca4c6a0a837db3a9813ee
This commit is contained in:
Dominique Martinet
2018-07-13 15:44:25 +09:00
committed by Dominique Martinet
parent 79e5026f01
commit ed7f5abc28

View File

@ -3189,7 +3189,7 @@ redo:
/* Switch to idle() when prev is PS_EXITED since it always reaches release_thread()
because it always resumes from just after ihk_mc_switch_context() call. See #1029 */
if (v->flags & CPU_FLAG_NEED_MIGRATE ||
prev->status == PS_EXITED) {
(prev && prev->status == PS_EXITED)) {
next = &cpu_local_var(idle);
} else {
/* Pick a new running process or one that has a pending signal */
@ -3274,7 +3274,7 @@ redo:
}
#ifdef PROFILE_ENABLE
if (prev->profile && prev->profile_start_ts != 0) {
if (prev && prev->profile && prev->profile_start_ts != 0) {
prev->profile_elapsed_ts +=
(rdtsc() - prev->profile_start_ts);
prev->profile_start_ts = 0;