@@ -543,17 +543,15 @@ pub fn read(pid: Pid, addr: AddressType) -> Result<c_long> {
543
543
544
544
/// Writes a word into the processes memory at the given address, as with
545
545
/// ptrace(PTRACE_POKEDATA, ...)
546
- ///
547
- /// # Safety
548
- ///
549
- /// The `data` argument is passed directly to `ptrace(2)`. Read that man page
550
- /// for guidance.
551
- pub unsafe fn write (
552
- pid : Pid ,
553
- addr : AddressType ,
554
- data : * mut c_void ,
555
- ) -> Result < ( ) > {
556
- unsafe { ptrace_other ( Request :: PTRACE_POKEDATA , pid, addr, data) . map ( drop) }
546
+ #[ allow( clippy:: not_unsafe_ptr_arg_deref) ]
547
+ pub fn write ( pid : Pid , addr : AddressType , data : c_long ) -> Result < ( ) > {
548
+ unsafe {
549
+ // Safety(not_unsafe_ptr_arg_deref):
550
+ // `ptrace_other` is a common abstract
551
+ // but in `PTRACE_POKEDATA` situation, `data` is exactly what will be wtitten
552
+ ptrace_other ( Request :: PTRACE_POKEDATA , pid, addr, data as * mut c_void )
553
+ . map ( drop)
554
+ }
557
555
}
558
556
559
557
/// Reads a word from a user area at `offset`, as with ptrace(PTRACE_PEEKUSER, ...).
@@ -564,17 +562,13 @@ pub fn read_user(pid: Pid, offset: AddressType) -> Result<c_long> {
564
562
565
563
/// Writes a word to a user area at `offset`, as with ptrace(PTRACE_POKEUSER, ...).
566
564
/// The user struct definition can be found in `/usr/include/sys/user.h`.
567
- ///
568
- /// # Safety
569
- ///
570
- /// The `data` argument is passed directly to `ptrace(2)`. Read that man page
571
- /// for guidance.
572
- pub unsafe fn write_user (
573
- pid : Pid ,
574
- offset : AddressType ,
575
- data : * mut c_void ,
576
- ) -> Result < ( ) > {
565
+ #[ allow( clippy:: not_unsafe_ptr_arg_deref) ]
566
+ pub fn write_user ( pid : Pid , offset : AddressType , data : c_long ) -> Result < ( ) > {
577
567
unsafe {
578
- ptrace_other ( Request :: PTRACE_POKEUSER , pid, offset, data) . map ( drop)
568
+ // Safety(not_unsafe_ptr_arg_deref):
569
+ // `ptrace_other` is a common abstract
570
+ // but in `PTRACE_POKEDATA` situation, `data` is exactly what will be wtitten
571
+ ptrace_other ( Request :: PTRACE_POKEUSER , pid, offset, data as * mut c_void )
572
+ . map ( drop)
579
573
}
580
574
}
0 commit comments