Skip to content

Commit

Permalink
Merge pull request #1461 from hermit-os/null-scheduler
Browse files Browse the repository at this point in the history
fix(x86_64): check for null pointer in `core_scheduler`
  • Loading branch information
stlankes authored Nov 19, 2024
2 parents d6177f0 + 8ea6295 commit 5f787a2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/arch/aarch64/kernel/core_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn core_id() -> CoreId {

#[inline]
pub(crate) fn core_scheduler() -> &'static mut PerCoreScheduler {
unsafe { &mut *CoreLocal::get().scheduler.get() }
unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() }
}

pub(crate) fn async_tasks() -> RefMut<'static, Vec<AsyncTask>> {
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64/kernel/core_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn core_id() -> CoreId {

#[inline]
pub fn core_scheduler() -> &'static mut PerCoreScheduler {
unsafe { &mut *(CoreLocal::get().scheduler.get()) }
unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() }
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/kernel/core_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub(crate) fn core_id() -> CoreId {
}

pub(crate) fn core_scheduler() -> &'static mut PerCoreScheduler {
unsafe { &mut *CoreLocal::get().scheduler.get() }
unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() }
}

pub(crate) fn async_tasks() -> RefMut<'static, Vec<AsyncTask>> {
Expand Down

0 comments on commit 5f787a2

Please sign in to comment.