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