Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
kmc-solid: Use expose_addr and from_exposed_addr for pointer-inte…
…ger casts

Pointer-integer casts are required for conversion between `EXINF` (ITRON
task entry point parameter) and `*const ThreadInner`. Addresses the
deny-level lint `fuzzy_provenance_casts`.
  • Loading branch information
kawadakk committed Dec 1, 2022
commit 427a079d318e68686cc7512838a23ed71315d8de
4 changes: 2 additions & 2 deletions library/std/src/sys/itron/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Thread {

unsafe extern "C" fn trampoline(exinf: isize) {
// Safety: `ThreadInner` is alive at this point
let inner = unsafe { &*(exinf as *const ThreadInner) };
let inner: &ThreadInner = unsafe { &*crate::ptr::from_exposed_addr(exinf as usize) };

// Safety: Since `trampoline` is called only once for each
// `ThreadInner` and only `trampoline` touches `start`,
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Thread {
abi::acre_tsk(&abi::T_CTSK {
// Activate this task immediately
tskatr: abi::TA_ACT,
exinf: inner_ptr as abi::EXINF,
exinf: inner_ptr.expose_addr() as abi::EXINF,
// The entry point
task: Some(trampoline),
// Inherit the calling task's base priority
Expand Down