Change ptr::eq to ptr::addr_eq where semantically more correct (#3105)
* Change ptr::eq to ptr::addr_eq where semantically more correct * not needed here?
This commit is contained in:
parent
c863c8bd6c
commit
ebc6c0d94c
@ -1106,7 +1106,7 @@ mod windows_logging {
|
||||
// Get the handle to standard output
|
||||
let h_stdout: HANDLE = get_stdout_handle();
|
||||
|
||||
if ptr::eq(h_stdout, INVALID_HANDLE_VALUE) {
|
||||
if ptr::addr_eq(h_stdout, INVALID_HANDLE_VALUE) {
|
||||
eprintln!("Failed to get standard output handle");
|
||||
return;
|
||||
}
|
||||
|
@ -1587,7 +1587,10 @@ where
|
||||
unsafe {
|
||||
// log::info!("Sending msg {:?}", msg);
|
||||
|
||||
assert!(!ptr::eq(self.last_msg_sent, msg), "Message sent twice!");
|
||||
assert!(
|
||||
!ptr::addr_eq(self.last_msg_sent, msg),
|
||||
"Message sent twice!"
|
||||
);
|
||||
assert!(
|
||||
(*msg).tag != LLMP_TAG_UNSET,
|
||||
"No tag set on message with id {:?}",
|
||||
|
@ -771,7 +771,7 @@ pub mod unix_shmem {
|
||||
shm_fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, libc::MAP_FAILED) {
|
||||
if ptr::addr_eq(map, libc::MAP_FAILED) {
|
||||
close(shm_fd);
|
||||
shm_unlink(filename_path.as_ptr() as *const _);
|
||||
return Err(Error::last_os_error(format!(
|
||||
@ -845,7 +845,7 @@ pub mod unix_shmem {
|
||||
shm_fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, libc::MAP_FAILED) {
|
||||
if ptr::addr_eq(map, libc::MAP_FAILED) {
|
||||
close(shm_fd);
|
||||
return Err(Error::last_os_error(format!(
|
||||
"mmap() failed for map with fd {shm_fd:?}"
|
||||
@ -1081,7 +1081,7 @@ pub mod unix_shmem {
|
||||
let id_int: i32 = id.into();
|
||||
let map = shmat(id_int, ptr::null(), 0) as *mut c_uchar;
|
||||
|
||||
if ptr::eq(map, ptr::null_mut::<c_uchar>().wrapping_sub(1)) {
|
||||
if ptr::addr_eq(map, ptr::null_mut::<c_uchar>().wrapping_sub(1)) {
|
||||
return Err(Error::last_os_error(format!(
|
||||
"Failed to map the shared mapping with id {id_int}"
|
||||
)));
|
||||
@ -1250,7 +1250,7 @@ pub mod unix_shmem {
|
||||
fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, usize::MAX as *mut c_void) {
|
||||
if ptr::addr_eq(map, usize::MAX as *mut c_void) {
|
||||
close(fd);
|
||||
return Err(Error::unknown(
|
||||
"Failed to map the ashmem mapping".to_string(),
|
||||
@ -1285,7 +1285,7 @@ pub mod unix_shmem {
|
||||
fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, usize::MAX as *mut c_void) {
|
||||
if ptr::addr_eq(map, usize::MAX as *mut c_void) {
|
||||
close(fd);
|
||||
return Err(Error::unknown(
|
||||
"Failed to map the ashmem mapping".to_string(),
|
||||
@ -1434,7 +1434,7 @@ pub mod unix_shmem {
|
||||
fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, libc::MAP_FAILED) {
|
||||
if ptr::addr_eq(map, libc::MAP_FAILED) {
|
||||
close(fd);
|
||||
return Err(Error::unknown(
|
||||
"Failed to map the memfd mapping".to_string(),
|
||||
@ -1471,7 +1471,7 @@ pub mod unix_shmem {
|
||||
fd,
|
||||
0,
|
||||
);
|
||||
if ptr::eq(map, libc::MAP_FAILED) {
|
||||
if ptr::addr_eq(map, libc::MAP_FAILED) {
|
||||
return Err(Error::last_os_error(format!(
|
||||
"mmap() failed for map with fd {fd:?}"
|
||||
)));
|
||||
|
@ -1608,7 +1608,7 @@ impl AsanRuntime {
|
||||
) -> *mut c_void {
|
||||
log::trace!("hook_mmap");
|
||||
let res = original(addr, length, prot, flags, fd, offset);
|
||||
if !ptr::eq(res, -1_isize as *mut c_void) {
|
||||
if !ptr::addr_eq(res, ptr::null_mut::<c_void>().wrapping_sub(1)) {
|
||||
self.allocator_mut()
|
||||
.map_shadow_for_region(res as usize, res as usize + length, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user