Skip to content

Commit

Permalink
Remove use of mut reference to a static mut
Browse files Browse the repository at this point in the history
Since we're working with pointer instead we can just use  `addr_of_mut!`
  • Loading branch information
sosthene-nitrokey committed Apr 22, 2024
1 parent 85c0ae7 commit 32f5446
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkcs11/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod sign;
pub mod token;
pub mod verify;

use std::ptr::addr_of_mut;
use std::sync::atomic::Ordering;

use crate::{
Expand All @@ -35,7 +36,7 @@ pub extern "C" fn C_GetFunctionList(
}

unsafe {
std::ptr::write(pp_fn_list, &mut data::FN_LIST);
std::ptr::write(pp_fn_list, addr_of_mut!(data::FN_LIST));
}
cryptoki_sys::CKR_OK
}
Expand Down

0 comments on commit 32f5446

Please sign in to comment.