diff --git a/fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs b/fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs index f587750ad8..04b7993c6f 100644 --- a/fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs +++ b/fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs @@ -25,7 +25,7 @@ use libafl_bolts::{current_nanos, nonzero, rands::StdRand, tuples::tuple_list, A /// Coverage map with explicit assignments due to the lack of instrumentation static mut SIGNALS: [u8; 16] = [0; 16]; -static mut SIGNALS_PTR: *mut u8 = &raw mut (SIGNALS) as _; +static mut SIGNALS_PTR: *mut u8 = &raw mut SIGNALS as _; static SIGNALS_LEN: usize = unsafe { (*&raw const (SIGNALS)).len() }; /// Assign a signal to the signals map diff --git a/fuzzers/baby/baby_fuzzer_unicode/src/main.rs b/fuzzers/baby/baby_fuzzer_unicode/src/main.rs index a9fd870ece..7543cc2ec7 100644 --- a/fuzzers/baby/baby_fuzzer_unicode/src/main.rs +++ b/fuzzers/baby/baby_fuzzer_unicode/src/main.rs @@ -24,7 +24,7 @@ use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice}; /// Coverage map with explicit assignments due to the lack of instrumentation static mut SIGNALS: [u8; 64] = [0; 64]; -static mut SIGNALS_PTR: *mut u8 = &raw mut (SIGNALS).cast(); +static mut SIGNALS_PTR: *mut u8 = &raw mut SIGNALS.cast(); static mut SIGNALS_LEN: usize = unsafe { (*&raw const (SIGNALS)).len() }; /// Assign a signal to the signals map diff --git a/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs b/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs index fa3deb36b7..309cc65c38 100644 --- a/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs +++ b/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs @@ -260,7 +260,7 @@ fn fuzz( HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_ALLOCATED_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/binary_only/qemu_launcher/src/instance.rs b/fuzzers/binary_only/qemu_launcher/src/instance.rs index 94dec83bf8..c2d8a943da 100644 --- a/fuzzers/binary_only/qemu_launcher/src/instance.rs +++ b/fuzzers/binary_only/qemu_launcher/src/instance.rs @@ -117,7 +117,7 @@ impl Instance<'_, M> { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/binary_only/tinyinst_simple/src/main.rs b/fuzzers/binary_only/tinyinst_simple/src/main.rs index e39a47e61d..35b5545855 100644 --- a/fuzzers/binary_only/tinyinst_simple/src/main.rs +++ b/fuzzers/binary_only/tinyinst_simple/src/main.rs @@ -37,7 +37,7 @@ fn main() { // use file to pass testcases // let args = vec!["test.exe".to_string(), "-f".to_string(), "@@".to_string()]; - let coverage = OwnedMutPtr::Ptr(&raw mut (COVERAGE)); + let coverage = OwnedMutPtr::Ptr(&raw mut COVERAGE); let observer = ListObserver::new("cov", coverage); let mut feedback = ListFeedback::new(&observer); #[cfg(windows)] @@ -69,7 +69,7 @@ fn main() { .persistent("test.exe".to_string(), "fuzz".to_string(), 1, 10000) .timeout(Duration::new(5, 0)) .shmem_provider(&mut shmem_provider) - .coverage_ptr(&raw mut (COVERAGE)) + .coverage_ptr(&raw mut COVERAGE) .build(tuple_list!(observer)) .unwrap(); diff --git a/fuzzers/full_system/qemu_baremetal/src/fuzzer_breakpoint.rs b/fuzzers/full_system/qemu_baremetal/src/fuzzer_breakpoint.rs index 54bfe73092..333fcb5b64 100644 --- a/fuzzers/full_system/qemu_baremetal/src/fuzzer_breakpoint.rs +++ b/fuzzers/full_system/qemu_baremetal/src/fuzzer_breakpoint.rs @@ -97,7 +97,7 @@ pub fn fuzz() { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/full_system/qemu_baremetal/src/fuzzer_low_level.rs b/fuzzers/full_system/qemu_baremetal/src/fuzzer_low_level.rs index e09e3ad43c..10e8ca632e 100644 --- a/fuzzers/full_system/qemu_baremetal/src/fuzzer_low_level.rs +++ b/fuzzers/full_system/qemu_baremetal/src/fuzzer_low_level.rs @@ -88,7 +88,7 @@ pub fn fuzz() { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/full_system/qemu_baremetal/src/fuzzer_sync_exit.rs b/fuzzers/full_system/qemu_baremetal/src/fuzzer_sync_exit.rs index e764da09c6..bc0cfa782a 100644 --- a/fuzzers/full_system/qemu_baremetal/src/fuzzer_sync_exit.rs +++ b/fuzzers/full_system/qemu_baremetal/src/fuzzer_sync_exit.rs @@ -52,7 +52,7 @@ pub fn fuzz() { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/full_system/qemu_linux_kernel/src/fuzzer.rs b/fuzzers/full_system/qemu_linux_kernel/src/fuzzer.rs index d7385e3024..4664dfa783 100644 --- a/fuzzers/full_system/qemu_linux_kernel/src/fuzzer.rs +++ b/fuzzers/full_system/qemu_linux_kernel/src/fuzzer.rs @@ -91,7 +91,7 @@ pub fn fuzz() { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_ALLOCATED_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/full_system/qemu_linux_process/src/fuzzer.rs b/fuzzers/full_system/qemu_linux_process/src/fuzzer.rs index 8d28b8254f..52fa72af6e 100644 --- a/fuzzers/full_system/qemu_linux_process/src/fuzzer.rs +++ b/fuzzers/full_system/qemu_linux_process/src/fuzzer.rs @@ -56,7 +56,7 @@ pub fn fuzz() { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/fuzzers/fuzz_anything/push_harness/src/main.rs b/fuzzers/fuzz_anything/push_harness/src/main.rs index 82c091b028..40b744c819 100644 --- a/fuzzers/fuzz_anything/push_harness/src/main.rs +++ b/fuzzers/fuzz_anything/push_harness/src/main.rs @@ -39,12 +39,12 @@ fn input_generator() { ExitKind::Ok }; - let signals_ptr = unsafe { &raw mut (SIGNALS) }; + let signals_ptr = unsafe { &raw mut SIGNALS }; let signals_len = unsafe { *signals_ptr }.len(); // Create an observation channel using the signals map let observer = - unsafe { StdMapObserver::from_mut_ptr("signals", &raw mut (SIGNALS) as _, signals_len) }; + unsafe { StdMapObserver::from_mut_ptr("signals", &raw mut SIGNALS as _, signals_len) }; // Feedback to rate the interestingness of an input let mut feedback = MaxMapFeedback::new(&observer); diff --git a/fuzzers/structure_aware/baby_fuzzer_custom_input/src/main.rs b/fuzzers/structure_aware/baby_fuzzer_custom_input/src/main.rs index 7dc5f6b2fc..873e26dea1 100644 --- a/fuzzers/structure_aware/baby_fuzzer_custom_input/src/main.rs +++ b/fuzzers/structure_aware/baby_fuzzer_custom_input/src/main.rs @@ -39,7 +39,7 @@ use { /// Coverage map with explicit assignments due to the lack of instrumentation const SIGNALS_LEN: usize = 16; static mut SIGNALS: [u8; SIGNALS_LEN] = [0; 16]; -static mut SIGNALS_PTR: *mut u8 = &raw mut (SIGNALS) as _; +static mut SIGNALS_PTR: *mut u8 = &raw mut SIGNALS as _; /// Assign a signal to the signals map fn signals_set(idx: usize) { diff --git a/fuzzers/structure_aware/baby_fuzzer_gramatron/src/main.rs b/fuzzers/structure_aware/baby_fuzzer_gramatron/src/main.rs index 0614faecc3..b4efb17f55 100644 --- a/fuzzers/structure_aware/baby_fuzzer_gramatron/src/main.rs +++ b/fuzzers/structure_aware/baby_fuzzer_gramatron/src/main.rs @@ -29,7 +29,7 @@ use libafl_bolts::{rands::StdRand, tuples::tuple_list}; /// Coverage map with explicit assignments due to the lack of instrumentation const SIGNALS_LEN: usize = 16; static mut SIGNALS: [u8; SIGNALS_LEN] = [0; SIGNALS_LEN]; -static mut SIGNALS_PTR: *mut u8 = unsafe { &raw mut (SIGNALS) as _ }; +static mut SIGNALS_PTR: *mut u8 = unsafe { &raw mut SIGNALS as _ }; /* /// Assign a signal to the signals map fn signals_set(idx: usize) { diff --git a/libafl/src/events/llmp/restarting.rs b/libafl/src/events/llmp/restarting.rs index ed7e83de2a..699a530d2d 100644 --- a/libafl/src/events/llmp/restarting.rs +++ b/libafl/src/events/llmp/restarting.rs @@ -652,7 +652,7 @@ where // At this point we are the fuzzer *NOT* the restarter. // We setup signal handlers to clean up shmem segments used by state restorer #[cfg(all(unix, not(miri)))] - if let Err(_e) = unsafe { setup_signal_handler(&raw mut (EVENTMGR_SIGHANDLER_STATE)) } { + if let Err(_e) = unsafe { setup_signal_handler(&raw mut EVENTMGR_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler. Print and ignore. log::error!("Failed to setup signal handlers: {_e}"); } diff --git a/libafl/src/events/simple.rs b/libafl/src/events/simple.rs index 79bd6f6939..7f076729a4 100644 --- a/libafl/src/events/simple.rs +++ b/libafl/src/events/simple.rs @@ -542,7 +542,7 @@ where // At this point we are the fuzzer *NOT* the restarter. // We setup signal handlers to clean up shmem segments used by state restorer #[cfg(all(unix, not(miri)))] - if let Err(_e) = unsafe { setup_signal_handler(&raw mut (EVENTMGR_SIGHANDLER_STATE)) } { + if let Err(_e) = unsafe { setup_signal_handler(&raw mut EVENTMGR_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler. Print and ignore. log::error!("Failed to setup signal handlers: {_e}"); } diff --git a/libafl/src/events/tcp.rs b/libafl/src/events/tcp.rs index a366e2ee8e..b058df1dcc 100644 --- a/libafl/src/events/tcp.rs +++ b/libafl/src/events/tcp.rs @@ -1325,7 +1325,7 @@ where // At this point we are the fuzzer *NOT* the restarter. // We setup signal handlers to clean up shmem segments used by state restorer #[cfg(all(unix, not(miri)))] - if let Err(_e) = unsafe { setup_signal_handler(&raw mut (EVENTMGR_SIGHANDLER_STATE)) } { + if let Err(_e) = unsafe { setup_signal_handler(&raw mut EVENTMGR_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler. Print and ignore. log::error!("Failed to setup signal handlers: {_e}"); } diff --git a/libafl/src/executors/hooks/inprocess.rs b/libafl/src/executors/hooks/inprocess.rs index 9add70f589..1c897f241a 100644 --- a/libafl/src/executors/hooks/inprocess.rs +++ b/libafl/src/executors/hooks/inprocess.rs @@ -203,7 +203,7 @@ where fn pre_exec(&mut self, state: &mut S, input: &S::Input) { #[cfg(feature = "std")] unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; (*data).crash_handler = self.crash_handler; (*data).timeout_handler = self.timeout_handler; } @@ -245,7 +245,7 @@ where // We get a pointer to `GLOBAL_STATE` that will be initialized at this point in time. // This unsafe is needed in stable but not in nightly. Remove in the future(?) #[allow(unused_unsafe)] - let data = unsafe { &raw mut (GLOBAL_STATE) }; + let data = unsafe { &raw mut GLOBAL_STATE }; #[cfg(feature = "std")] unix_signal_handler::setup_panic_hook::(); // # Safety @@ -287,7 +287,7 @@ where let ret; #[cfg(feature = "std")] unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; crate::executors::hooks::windows::windows_exception_handler::setup_panic_hook::< E, EM, diff --git a/libafl/src/executors/hooks/inprocess_fork.rs b/libafl/src/executors/hooks/inprocess_fork.rs index 5870e0a560..16af31f8b2 100644 --- a/libafl/src/executors/hooks/inprocess_fork.rs +++ b/libafl/src/executors/hooks/inprocess_fork.rs @@ -46,7 +46,7 @@ where /// Call before running a target. fn pre_exec(&mut self, _state: &mut S, _input: &S::Input) { unsafe { - let data = &raw mut (FORK_EXECUTOR_GLOBAL_DATA); + let data = &raw mut FORK_EXECUTOR_GLOBAL_DATA; (*data).crash_handler = self.crash_handler; (*data).timeout_handler = self.timeout_handler; compiler_fence(Ordering::SeqCst); @@ -65,7 +65,7 @@ impl InChildProcessHooks { { #[cfg_attr(miri, allow(unused_variables, unused_unsafe))] unsafe { - let data = &raw mut (FORK_EXECUTOR_GLOBAL_DATA); + let data = &raw mut FORK_EXECUTOR_GLOBAL_DATA; // child_signal_handlers::setup_child_panic_hook::(); #[cfg(not(miri))] setup_signal_handler(data)?; @@ -157,14 +157,14 @@ impl SignalHandler for InProcessForkExecutorGlobalData { if !FORK_EXECUTOR_GLOBAL_DATA.timeout_handler.is_null() { let func: ForkHandlerFuncPtr = transmute(FORK_EXECUTOR_GLOBAL_DATA.timeout_handler); - (func)(signal, info, context, &raw mut (FORK_EXECUTOR_GLOBAL_DATA)); + (func)(signal, info, context, &raw mut FORK_EXECUTOR_GLOBAL_DATA); } }, _ => unsafe { if !FORK_EXECUTOR_GLOBAL_DATA.crash_handler.is_null() { let func: ForkHandlerFuncPtr = transmute(FORK_EXECUTOR_GLOBAL_DATA.crash_handler); - (func)(signal, info, context, &raw mut (FORK_EXECUTOR_GLOBAL_DATA)); + (func)(signal, info, context, &raw mut FORK_EXECUTOR_GLOBAL_DATA); } }, } diff --git a/libafl/src/executors/hooks/timer.rs b/libafl/src/executors/hooks/timer.rs index e03e6e5114..b8eb1ebf37 100644 --- a/libafl/src/executors/hooks/timer.rs +++ b/libafl/src/executors/hooks/timer.rs @@ -1,6 +1,5 @@ //! The struct `TimerStruct` will absorb all the difference in timeout implementation in various system. -use core::time::Duration; -#[cfg(any(windows, target_os = "linux"))] +#[cfg(any(windows, target_os = "linux", unix))] use core::time::Duration; #[cfg(target_os = "linux")] use core::{mem::zeroed, ptr::null_mut}; @@ -184,7 +183,7 @@ impl TimerStruct { let ptp_timer = unsafe { CreateThreadpoolTimer( Some(timeout_handler), - Some(&raw mut (GLOBAL_STATE) as *mut c_void), + Some(&raw mut GLOBAL_STATE as *mut c_void), Some(&TP_CALLBACK_ENVIRON_V3::default()), ) } @@ -224,7 +223,7 @@ impl TimerStruct { unsafe { #[cfg(not(miri))] // creates a new per-process interval timer - libc::timer_create(libc::CLOCK_MONOTONIC, null_mut(), &raw mut (timerid)); + libc::timer_create(libc::CLOCK_MONOTONIC, null_mut(), &raw mut timerid); } Self { @@ -265,11 +264,11 @@ impl TimerStruct { /// Set timer pub fn set_timer(&mut self) { unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; write_volatile(&raw mut ((*data).ptp_timer), Some(*self.ptp_timer())); write_volatile( - &raw mut ((*data).critical), + &raw mut (*data).critical, &raw mut (*self.critical_mut()) as *mut c_void, ); let tm: i64 = -self.milli_sec() * 10 * 1000; @@ -297,13 +296,13 @@ impl TimerStruct { unsafe { if self.batch_mode { if self.executions == 0 { - libc::timer_settime(self.timerid, 0, &raw mut (self.itimerspec), null_mut()); + libc::timer_settime(self.timerid, 0, &raw mut self.itimerspec, null_mut()); self.tmout_start_time = current_time(); } self.start_time = current_time(); } else { #[cfg(not(miri))] - libc::timer_settime(self.timerid, 0, &raw mut (self.itimerspec), null_mut()); + libc::timer_settime(self.timerid, 0, &raw mut self.itimerspec, null_mut()); } } } @@ -362,7 +361,7 @@ impl TimerStruct { // # Safety // The value accesses are guarded by a critical section. unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; compiler_fence(Ordering::SeqCst); EnterCriticalSection(self.critical_mut()); diff --git a/libafl/src/executors/hooks/unix.rs b/libafl/src/executors/hooks/unix.rs index 1e32103221..a63adb0563 100644 --- a/libafl/src/executors/hooks/unix.rs +++ b/libafl/src/executors/hooks/unix.rs @@ -51,7 +51,7 @@ pub mod unix_signal_handler { context: Option<&mut ucontext_t>, ) { unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); match signal { Signal::SigUser2 | Signal::SigAlarm => { @@ -91,7 +91,7 @@ pub mod unix_signal_handler { let old_hook = panic::take_hook(); panic::set_hook(Box::new(move |panic_info| unsafe { old_hook(panic_info); - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); if (*data).is_valid() { // We are fuzzing! diff --git a/libafl/src/executors/hooks/windows.rs b/libafl/src/executors/hooks/windows.rs index 7a023cf977..12b65ca779 100644 --- a/libafl/src/executors/hooks/windows.rs +++ b/libafl/src/executors/hooks/windows.rs @@ -35,7 +35,7 @@ pub mod windows_asan_handler { <::State as HasSolutions>::Solutions: Corpus, //delete me <<::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; (*data).set_in_handler(true); // Have we set a timer_before? if (*data).ptp_timer.is_some() { @@ -161,7 +161,7 @@ pub mod windows_exception_handler { exception_pointers: *mut EXCEPTION_POINTERS, ) { unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); if !(*data).crash_handler.is_null() { let func: HandlerFuncPtr = transmute((*data).crash_handler); @@ -196,7 +196,7 @@ pub mod windows_exception_handler { { let old_hook = panic::take_hook(); panic::set_hook(Box::new(move |panic_info| unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); // Have we set a timer_before? if (*data).ptp_timer.is_some() { diff --git a/libafl/src/executors/inprocess/inner.rs b/libafl/src/executors/inprocess/inner.rs index bfed799527..8ba5c18b64 100644 --- a/libafl/src/executors/inprocess/inner.rs +++ b/libafl/src/executors/inprocess/inner.rs @@ -99,7 +99,7 @@ where executor_ptr: *const c_void, ) { unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; write_volatile( &raw mut ((*data).current_input_ptr), ptr::from_ref(input) as *const c_void, @@ -133,7 +133,7 @@ where _input: &::Input, ) { unsafe { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; write_volatile(&raw mut ((*data).current_input_ptr), null()); compiler_fence(Ordering::SeqCst); diff --git a/libafl/src/executors/inprocess/mod.rs b/libafl/src/executors/inprocess/mod.rs index 9a9d144526..9b477f4707 100644 --- a/libafl/src/executors/inprocess/mod.rs +++ b/libafl/src/executors/inprocess/mod.rs @@ -509,7 +509,7 @@ where + ExecutionProcessor, <::State as HasSolutions>::Solutions: Corpus, //delete me { - let data = &raw mut (GLOBAL_STATE); + let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); if (*data).is_valid() { diff --git a/libafl/src/executors/inprocess_fork/inner.rs b/libafl/src/executors/inprocess_fork/inner.rs index 532052d908..8b22e0ae8e 100644 --- a/libafl/src/executors/inprocess_fork/inner.rs +++ b/libafl/src/executors/inprocess_fork/inner.rs @@ -144,10 +144,10 @@ where let mut timerid: libc::timer_t = null_mut(); // creates a new per-process interval timer // we can't do this from the parent, timerid is unique to each process. - libc::timer_create(libc::CLOCK_MONOTONIC, null_mut(), &raw mut (timerid)); + libc::timer_create(libc::CLOCK_MONOTONIC, null_mut(), &raw mut timerid); // log::info!("Set timer! {:#?} {timerid:#?}", self.itimerspec); - let _: i32 = libc::timer_settime(timerid, 0, &raw mut (self.itimerspec), null_mut()); + let _: i32 = libc::timer_settime(timerid, 0, &raw mut self.itimerspec, null_mut()); } #[cfg(not(target_os = "linux"))] { @@ -224,7 +224,7 @@ where input: &::Input, ) { unsafe { - let data = &raw mut (FORK_EXECUTOR_GLOBAL_DATA); + let data = &raw mut FORK_EXECUTOR_GLOBAL_DATA; write_volatile( &raw mut ((*data).executor_ptr), ptr::from_ref(self) as *const c_void, diff --git a/libafl/src/executors/inprocess_fork/mod.rs b/libafl/src/executors/inprocess_fork/mod.rs index 311cb974bc..fd5e7c3f6c 100644 --- a/libafl/src/executors/inprocess_fork/mod.rs +++ b/libafl/src/executors/inprocess_fork/mod.rs @@ -283,7 +283,7 @@ pub mod child_signal_handlers { let old_hook = panic::take_hook(); panic::set_hook(Box::new(move |panic_info| unsafe { old_hook(panic_info); - let data = &raw mut (FORK_EXECUTOR_GLOBAL_DATA); + let data = &raw mut FORK_EXECUTOR_GLOBAL_DATA; if !data.is_null() && (*data).is_valid() { let executor = (*data).executor_mut::(); let mut observers = executor.observers_mut(); diff --git a/libafl_bolts/src/anymap.rs b/libafl_bolts/src/anymap.rs index 9afbc9a296..29eae29e03 100644 --- a/libafl_bolts/src/anymap.rs +++ b/libafl_bolts/src/anymap.rs @@ -13,7 +13,7 @@ use core::{any::TypeId, mem::size_of, ptr::read_unaligned}; pub const fn pack_type_id(id: u128) -> TypeId { // TypeId size of other sizes is not yet supported" static_assertions::const_assert!(size_of::() == 16); - unsafe { *(&raw const (id) as *const TypeId) } + unsafe { *(&raw const id as *const TypeId) } } /// Unpack a `type_id` to an `u128` @@ -28,7 +28,7 @@ pub const fn unpack_type_id(id: TypeId) -> u128 { // see any.rs, it's alway u128 hence 16 bytes. // TypeId size of other sizes is not yet supported" static_assertions::const_assert!(size_of::() == 16); - let ret: u128 = unsafe { read_unaligned::(&raw const (id) as *const u128) }; + let ret: u128 = unsafe { read_unaligned::(&raw const id as *const u128) }; ret } diff --git a/libafl_bolts/src/lib.rs b/libafl_bolts/src/lib.rs index 932e248676..5bf6e789c4 100644 --- a/libafl_bolts/src/lib.rs +++ b/libafl_bolts/src/lib.rs @@ -1280,7 +1280,7 @@ mod tests { unsafe { LIBAFL_RAWFD_LOGGER.fd = stdout().as_raw_fd() }; unsafe { - log::set_logger(&*&raw const (LIBAFL_RAWFD_LOGGER)).unwrap(); + log::set_logger(&*&raw const LIBAFL_RAWFD_LOGGER).unwrap(); } log::set_max_level(log::LevelFilter::Debug); log::info!("Test"); diff --git a/libafl_bolts/src/llmp.rs b/libafl_bolts/src/llmp.rs index 0510a6e673..f2935c0ec5 100644 --- a/libafl_bolts/src/llmp.rs +++ b/libafl_bolts/src/llmp.rs @@ -2352,7 +2352,7 @@ impl Brokers { #[cfg(any(all(unix, not(miri)), all(windows, feature = "std")))] fn setup_handlers() { #[cfg(all(unix, not(miri)))] - if let Err(e) = unsafe { setup_signal_handler(&raw mut (LLMP_SIGHANDLER_STATE)) } { + if let Err(e) = unsafe { setup_signal_handler(&raw mut LLMP_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler - Ignore. log::info!("Failed to setup signal handlers: {e}"); } else { @@ -2360,7 +2360,7 @@ impl Brokers { } #[cfg(all(windows, feature = "std"))] - if let Err(e) = unsafe { setup_ctrl_handler(&raw mut (LLMP_SIGHANDLER_STATE)) } { + if let Err(e) = unsafe { setup_ctrl_handler(&raw mut LLMP_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler - Ignore. log::info!("Failed to setup control handlers: {e}"); } else { @@ -2805,7 +2805,7 @@ where #[cfg(any(all(unix, not(miri)), all(windows, feature = "std")))] fn setup_handlers() { #[cfg(all(unix, not(miri)))] - if let Err(e) = unsafe { setup_signal_handler(&raw mut (LLMP_SIGHANDLER_STATE)) } { + if let Err(e) = unsafe { setup_signal_handler(&raw mut LLMP_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler - Ignore. log::info!("Failed to setup signal handlers: {e}"); } else { @@ -2813,7 +2813,7 @@ where } #[cfg(all(windows, feature = "std"))] - if let Err(e) = unsafe { setup_ctrl_handler(&raw mut (LLMP_SIGHANDLER_STATE)) } { + if let Err(e) = unsafe { setup_ctrl_handler(&raw mut LLMP_SIGHANDLER_STATE) } { // We can live without a proper ctrl+c signal handler - Ignore. log::info!("Failed to setup control handlers: {e}"); } else { diff --git a/libafl_bolts/src/os/unix_signals.rs b/libafl_bolts/src/os/unix_signals.rs index 0a81a8dfa8..30e2895703 100644 --- a/libafl_bolts/src/os/unix_signals.rs +++ b/libafl_bolts/src/os/unix_signals.rs @@ -477,11 +477,11 @@ pub unsafe fn setup_signal_handler( let mut ss: stack_t = mem::zeroed(); ss.ss_size = SIGNAL_STACK_SIZE; ss.ss_sp = SIGNAL_STACK_PTR; - sigaltstack(&raw mut (ss), ptr::null_mut() as _); + sigaltstack(&raw mut ss, ptr::null_mut() as _); let mut sa: sigaction = mem::zeroed(); - sigemptyset(&raw mut (sa.sa_mask)); - sigaddset(&raw mut (sa.sa_mask), SIGALRM); + sigemptyset(&raw mut sa.sa_mask); + sigaddset(&raw mut sa.sa_mask, SIGALRM); sa.sa_flags = SA_NODEFER | SA_SIGINFO | SA_ONSTACK; sa.sa_sigaction = handle_signal as usize; let signals = unsafe { (*handler).signals() }; diff --git a/libafl_bolts/src/os/windows_exceptions.rs b/libafl_bolts/src/os/windows_exceptions.rs index bb39ed3bf7..d1098c98e8 100644 --- a/libafl_bolts/src/os/windows_exceptions.rs +++ b/libafl_bolts/src/os/windows_exceptions.rs @@ -543,7 +543,7 @@ pub unsafe fn setup_exception_handler( .position(|x| *x == exception_code) .unwrap(); write_volatile( - &raw mut (EXCEPTION_HANDLERS[index]), + &raw mut EXCEPTION_HANDLERS[index], Some(HandlerHolder { handler: UnsafeCell::new(handler as *mut dyn ExceptionHandler), }), diff --git a/libafl_bolts/src/tuples.rs b/libafl_bolts/src/tuples.rs index 862b6bc655..05280f3298 100644 --- a/libafl_bolts/src/tuples.rs +++ b/libafl_bolts/src/tuples.rs @@ -242,7 +242,7 @@ where { fn match_first_type(&self) -> Option<&T> { if TypeId::of::() == TypeId::of::() { - unsafe { (&raw const (self.0) as *const T).as_ref() } + unsafe { (&raw const self.0 as *const T).as_ref() } } else { self.1.match_first_type::() } @@ -250,7 +250,7 @@ where fn match_first_type_mut(&mut self) -> Option<&mut T> { if TypeId::of::() == TypeId::of::() { - unsafe { (&raw mut (self.0) as *mut T).as_mut() } + unsafe { (&raw mut self.0 as *mut T).as_mut() } } else { self.1.match_first_type_mut::() } @@ -397,7 +397,7 @@ where fn match_type(&self, f: &mut FN) { // Switch this check to https://stackoverflow.com/a/60138532/7658998 when in stable and remove 'static if TypeId::of::() == TypeId::of::() { - f(unsafe { (&raw const (self.0) as *const T).as_ref() }.unwrap()); + f(unsafe { (&raw const self.0 as *const T).as_ref() }.unwrap()); } self.1.match_type::(f); } @@ -405,7 +405,7 @@ where fn match_type_mut(&mut self, f: &mut FN) { // Switch this check to https://stackoverflow.com/a/60138532/7658998 when in stable and remove 'static if TypeId::of::() == TypeId::of::() { - f(unsafe { (&raw mut (self.0) as *mut T).as_mut() }.unwrap()); + f(unsafe { (&raw mut self.0 as *mut T).as_mut() }.unwrap()); } self.1.match_type_mut::(f); } @@ -493,7 +493,7 @@ where { fn match_name(&self, name: &str) -> Option<&T> { if type_eq::() && name == self.0.name() { - unsafe { (&raw const (self.0) as *const T).as_ref() } + unsafe { (&raw const self.0 as *const T).as_ref() } } else { self.1.match_name::(name) } @@ -501,7 +501,7 @@ where fn match_name_mut(&mut self, name: &str) -> Option<&mut T> { if type_eq::() && name == self.0.name() { - unsafe { (&raw mut (self.0) as *mut T).as_mut() } + unsafe { (&raw mut self.0 as *mut T).as_mut() } } else { self.1.match_name_mut::(name) } diff --git a/libafl_frida/src/asan/asan_rt.rs b/libafl_frida/src/asan/asan_rt.rs index 03c631ea74..c65723b77e 100644 --- a/libafl_frida/src/asan/asan_rt.rs +++ b/libafl_frida/src/asan/asan_rt.rs @@ -358,7 +358,7 @@ impl AsanRuntime { // rlim_cur: 0, // rlim_max: 0, // }; - // assert!(unsafe { getrlimit(RLIMIT_STACK, &raw mut (stack_rlimit)) } == 0); + // assert!(unsafe { getrlimit(RLIMIT_STACK, &raw mut stack_rlimit) } == 0); // // stack_rlimit.rlim_cur as usize // } @@ -371,7 +371,7 @@ impl AsanRuntime { // rlim_cur: 0, // rlim_max: 0, // }; - // assert!(unsafe { getrlimit64(RLIMIT_STACK, &raw mut (stack_rlimit)) } == 0); + // assert!(unsafe { getrlimit64(RLIMIT_STACK, &raw mut stack_rlimit) } == 0); // // stack_rlimit.rlim_cur as usize // } @@ -415,7 +415,7 @@ impl AsanRuntime { #[must_use] pub fn current_stack() -> (usize, usize) { let mut stack_var = 0xeadbeef; - let stack_address = &raw mut (stack_var) as usize; + let stack_address = &raw mut stack_var as usize; // let range_details = RangeDetails::with_address(stack_address as u64).unwrap(); // Write something to (hopefully) make sure the val isn't optimized out diff --git a/libafl_frida/src/coverage_rt.rs b/libafl_frida/src/coverage_rt.rs index cdd281e546..57a496524c 100644 --- a/libafl_frida/src/coverage_rt.rs +++ b/libafl_frida/src/coverage_rt.rs @@ -83,8 +83,8 @@ impl CoverageRuntime { #[allow(clippy::cast_possible_wrap)] pub fn generate_inline_code(&mut self, h64: u64) -> Box<[u8]> { let mut borrow = self.0.borrow_mut(); - let prev_loc_ptr = &raw mut (borrow.previous_pc); - let map_addr_ptr = &raw mut (borrow.map); + let prev_loc_ptr = &raw mut borrow.previous_pc; + let map_addr_ptr = &raw mut borrow.map; let mut ops = dynasmrt::VecAssembler::::new(0); dynasm!(ops ; .arch aarch64 @@ -141,8 +141,8 @@ impl CoverageRuntime { #[cfg(target_arch = "x86_64")] pub fn generate_inline_code(&mut self, h64: u64) -> Box<[u8]> { let mut borrow = self.0.borrow_mut(); - let prev_loc_ptr = &raw mut (borrow.previous_pc); - let map_addr_ptr = &raw mut (borrow.map); + let prev_loc_ptr = &raw mut borrow.previous_pc; + let map_addr_ptr = &raw mut borrow.map; let mut ops = dynasmrt::VecAssembler::::new(0); dynasm!(ops ; .arch x64 diff --git a/libafl_qemu/src/modules/calls.rs b/libafl_qemu/src/modules/calls.rs index 3f14beab39..031528e29e 100644 --- a/libafl_qemu/src/modules/calls.rs +++ b/libafl_qemu/src/modules/calls.rs @@ -452,7 +452,7 @@ where #[cfg(feature = "systemmode")] fn page_filter_mut(&mut self) -> &mut Self::ModulePageFilter { - unsafe { &raw mut (NOP_PAGE_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_PAGE_FILTER.as_mut().unwrap().get_mut() } } } @@ -547,7 +547,7 @@ impl FullBacktraceCollector { /// # Safety /// This accesses the global [`CALLSTACKS`] variable and may not be called concurrently. pub unsafe fn new() -> Self { - unsafe { (*&raw mut (CALLSTACKS)) = Some(ThreadLocal::new()) }; + unsafe { (*&raw mut CALLSTACKS) = Some(ThreadLocal::new()) }; Self {} } @@ -557,7 +557,7 @@ impl FullBacktraceCollector { // While it is racey, it might be fine if multiple clear the vecs concurrently. // TODO: This should probably be rewritten in a safer way. unsafe { - for tls in (*&raw mut (CALLSTACKS)).as_mut().unwrap().iter_mut() { + for tls in (*&raw mut CALLSTACKS).as_mut().unwrap().iter_mut() { (*tls.get()).clear(); } } @@ -568,7 +568,7 @@ impl FullBacktraceCollector { // This accesses the global [`CALLSTACKS`] variable. // However, the actual variable access is behind a `ThreadLocal` class. unsafe { - if let Some(c) = (*&raw mut (CALLSTACKS)).as_mut() { + if let Some(c) = (*&raw mut CALLSTACKS).as_mut() { Some(&*c.get_or_default().get()) } else { None @@ -591,7 +591,7 @@ impl CallTraceCollector for FullBacktraceCollector { { // TODO handle Thumb unsafe { - (*(*&raw mut (CALLSTACKS)) + (*(*&raw mut CALLSTACKS) .as_mut() .unwrap() .get_or_default() @@ -612,7 +612,7 @@ impl CallTraceCollector for FullBacktraceCollector { S: Unpin + UsesInput, { unsafe { - let v = &mut *(*&raw mut (CALLSTACKS)) + let v = &mut *(*&raw mut CALLSTACKS) .as_mut() .unwrap() .get_or_default() diff --git a/libafl_qemu/src/modules/cmplog.rs b/libafl_qemu/src/modules/cmplog.rs index 1dd634307e..65fa59ed42 100644 --- a/libafl_qemu/src/modules/cmplog.rs +++ b/libafl_qemu/src/modules/cmplog.rs @@ -103,7 +103,7 @@ where #[cfg(feature = "systemmode")] fn page_filter_mut(&mut self) -> &mut Self::ModulePageFilter { - unsafe { &raw mut (NOP_PAGE_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_PAGE_FILTER.as_mut().unwrap().get_mut() } } } @@ -168,7 +168,7 @@ where #[cfg(feature = "systemmode")] fn page_filter_mut(&mut self) -> &mut Self::ModulePageFilter { - unsafe { &raw mut (NOP_PAGE_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_PAGE_FILTER.as_mut().unwrap().get_mut() } } } diff --git a/libafl_qemu/src/modules/drcov.rs b/libafl_qemu/src/modules/drcov.rs index 28dd6efd0a..f9fddcb27f 100644 --- a/libafl_qemu/src/modules/drcov.rs +++ b/libafl_qemu/src/modules/drcov.rs @@ -351,7 +351,7 @@ where #[cfg(feature = "systemmode")] fn page_filter_mut(&mut self) -> &mut Self::ModulePageFilter { - unsafe { &raw mut (NOP_PAGE_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_PAGE_FILTER.as_mut().unwrap().get_mut() } } } diff --git a/libafl_qemu/src/modules/edges/helpers.rs b/libafl_qemu/src/modules/edges/helpers.rs index 23cf4c3ee8..b661584c39 100644 --- a/libafl_qemu/src/modules/edges/helpers.rs +++ b/libafl_qemu/src/modules/edges/helpers.rs @@ -95,10 +95,7 @@ mod generators { { unsafe { assert!(LIBAFL_QEMU_EDGES_MAP_MASK_MAX > 0); - assert_ne!( - *&raw const (LIBAFL_QEMU_EDGES_MAP_SIZE_PTR), - ptr::null_mut() - ); + assert_ne!(*&raw const LIBAFL_QEMU_EDGES_MAP_SIZE_PTR, ptr::null_mut()); } #[cfg(feature = "usermode")] diff --git a/libafl_qemu/src/modules/edges/mod.rs b/libafl_qemu/src/modules/edges/mod.rs index e9236f2259..db2538ca7e 100644 --- a/libafl_qemu/src/modules/edges/mod.rs +++ b/libafl_qemu/src/modules/edges/mod.rs @@ -389,7 +389,7 @@ mod tests { HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/libafl_qemu/src/modules/usermode/injections.rs b/libafl_qemu/src/modules/usermode/injections.rs index a705f2452c..a381c9c294 100644 --- a/libafl_qemu/src/modules/usermode/injections.rs +++ b/libafl_qemu/src/modules/usermode/injections.rs @@ -339,7 +339,7 @@ where } fn address_filter_mut(&mut self) -> &mut Self::ModuleAddressFilter { - unsafe { &raw mut (NOP_ADDRESS_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_ADDRESS_FILTER.as_mut().unwrap().get_mut() } } } diff --git a/libafl_qemu/src/modules/usermode/snapshot.rs b/libafl_qemu/src/modules/usermode/snapshot.rs index fbc3ce1469..58050f23ef 100644 --- a/libafl_qemu/src/modules/usermode/snapshot.rs +++ b/libafl_qemu/src/modules/usermode/snapshot.rs @@ -717,7 +717,7 @@ where } fn address_filter_mut(&mut self) -> &mut Self::ModuleAddressFilter { - unsafe { &raw mut (NOP_ADDRESS_FILTER).as_mut().unwrap().get_mut() } + unsafe { &raw mut NOP_ADDRESS_FILTER.as_mut().unwrap().get_mut() } } } diff --git a/libafl_qemu/src/qemu/mod.rs b/libafl_qemu/src/qemu/mod.rs index beb41e0fba..1b4411dded 100644 --- a/libafl_qemu/src/qemu/mod.rs +++ b/libafl_qemu/src/qemu/mod.rs @@ -1107,7 +1107,7 @@ pub mod pybind { extern "C" fn py_generic_hook_wrapper(idx: u64, _pc: GuestAddr) { let obj = unsafe { - let hooks = &mut *&raw mut (PY_GENERIC_HOOKS); + let hooks = &mut *&raw mut PY_GENERIC_HOOKS; &hooks[idx as usize].1 }; Python::with_gil(|py| { @@ -1187,7 +1187,7 @@ pub mod pybind { /// Removes a hooke from `PY_GENERIC_HOOKS` -> may not be called concurrently! unsafe fn set_hook(&self, addr: GuestAddr, hook: PyObject) { unsafe { - let hooks = &mut *&raw mut (PY_GENERIC_HOOKS); + let hooks = &mut *&raw mut PY_GENERIC_HOOKS; let idx = hooks.len(); hooks.push((addr, hook)); self.qemu.hooks().add_instruction_hooks( @@ -1203,7 +1203,7 @@ pub mod pybind { /// Removes a hooke from `PY_GENERIC_HOOKS` -> may not be called concurrently! unsafe fn remove_hooks_at(&self, addr: GuestAddr) -> usize { unsafe { - let hooks = &mut *&raw mut (PY_GENERIC_HOOKS); + let hooks = &mut *&raw mut PY_GENERIC_HOOKS; hooks.retain(|(a, _)| *a != addr); } self.qemu.hooks().remove_instruction_hooks_at(addr, true) diff --git a/libafl_sugar/src/qemu.rs b/libafl_sugar/src/qemu.rs index e8e3b71f9b..f9d3958f57 100644 --- a/libafl_sugar/src/qemu.rs +++ b/libafl_sugar/src/qemu.rs @@ -159,7 +159,7 @@ where HitcountsMapObserver::new(VariableMapObserver::from_mut_slice( "edges", OwnedMutSlice::from_raw_parts_mut(edges_map_mut_ptr(), EDGES_MAP_DEFAULT_SIZE), - &raw mut (MAX_EDGES_FOUND), + &raw mut MAX_EDGES_FOUND, )) .track_indices() }; diff --git a/libafl_targets/src/coverage.rs b/libafl_targets/src/coverage.rs index 4893816771..43733f0c36 100644 --- a/libafl_targets/src/coverage.rs +++ b/libafl_targets/src/coverage.rs @@ -164,7 +164,7 @@ pub fn edges_map_mut_ptr() -> *mut u8 { assert!(!EDGES_MAP_PTR.is_null()); EDGES_MAP_PTR } else { - &raw mut (EDGES_MAP) as *mut u8 + &raw mut EDGES_MAP as *mut u8 } } } diff --git a/libafl_targets/src/libfuzzer/mod.rs b/libafl_targets/src/libfuzzer/mod.rs index 3f78c472f8..31bae56d35 100644 --- a/libafl_targets/src/libfuzzer/mod.rs +++ b/libafl_targets/src/libfuzzer/mod.rs @@ -36,7 +36,7 @@ pub unsafe fn libfuzzer_initialize(args: &[String]) -> i32 { let argc = argv.len() as i32; unsafe { let argv_ptr = argv.as_ptr(); - libafl_targets_libfuzzer_init(&raw const (argc), &raw const (argv_ptr)) + libafl_targets_libfuzzer_init(&raw const argc, &raw const argv_ptr) } } diff --git a/libafl_targets/src/sancov_8bit.rs b/libafl_targets/src/sancov_8bit.rs index 5230c656b8..9f6b741bb5 100644 --- a/libafl_targets/src/sancov_8bit.rs +++ b/libafl_targets/src/sancov_8bit.rs @@ -192,7 +192,7 @@ mod observers { let elem = self.intervals.query(idx..=idx).next().unwrap(); let i = elem.value; let j = idx - elem.interval.start; - unsafe { (*&raw const (COUNTERS_MAPS[*i])).as_slice()[j] } + unsafe { (*&raw const COUNTERS_MAPS[*i]).as_slice()[j] } } #[inline] diff --git a/libafl_targets/src/sancov_pcguard.rs b/libafl_targets/src/sancov_pcguard.rs index 89fcae6791..c5a8a06ba5 100644 --- a/libafl_targets/src/sancov_pcguard.rs +++ b/libafl_targets/src/sancov_pcguard.rs @@ -186,7 +186,7 @@ unsafe fn update_ngram(pos: usize) -> usize { let mut reduced = pos; #[cfg(feature = "sancov_ngram4")] { - let prev_array_4 = &mut *&raw mut (PREV_ARRAY_4); + let prev_array_4 = &mut *&raw mut PREV_ARRAY_4; *prev_array_4 = prev_array_4.rotate_elements_right::<1>(); prev_array_4.shl_assign(SHR_4); prev_array_4.as_mut_array()[0] = pos as u32; @@ -194,7 +194,7 @@ unsafe fn update_ngram(pos: usize) -> usize { } #[cfg(feature = "sancov_ngram8")] { - let prev_array_8 = &mut *&raw mut (PREV_ARRAY_8); + let prev_array_8 = &mut *&raw mut PREV_ARRAY_8; *prev_array_8 = prev_array_8.rotate_elements_right::<1>(); prev_array_8.shl_assign(SHR_8); prev_array_8.as_mut_array()[0] = pos as u32; @@ -253,7 +253,7 @@ pub unsafe extern "C" fn __sanitizer_cov_trace_pc_guard(guard: *mut u32) { } #[cfg(not(feature = "pointer_maps"))] { - let edges_map = &mut *&raw mut (EDGES_MAP); + let edges_map = &mut *&raw mut EDGES_MAP; #[cfg(feature = "sancov_pcguard_edges")] { *(edges_map).get_unchecked_mut(pos) = 1; @@ -274,7 +274,7 @@ pub unsafe extern "C" fn __sanitizer_cov_trace_pc_guard(guard: *mut u32) { pub unsafe extern "C" fn __sanitizer_cov_trace_pc_guard_init(mut start: *mut u32, stop: *mut u32) { #[cfg(feature = "pointer_maps")] if EDGES_MAP_PTR.is_null() { - EDGES_MAP_PTR = &raw mut (EDGES_MAP) as *mut u8; + EDGES_MAP_PTR = &raw mut EDGES_MAP as *mut u8; } if start == stop || *start != 0 { @@ -347,7 +347,7 @@ pub fn sanitizer_cov_pc_table<'a>() -> impl Iterator // SAFETY: Once PCS_BEG and PCS_END have been initialized, will not be written to again. So // there's no TOCTOU issue. unsafe { - let pc_tables = &*&raw const (PC_TABLES); + let pc_tables = &*&raw const PC_TABLES; pc_tables.iter().copied() } }