diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 725dfc347..6684838b6 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -1813,7 +1813,7 @@ impl vm::Vm for MshvVm { MSHV_VP_MMAP_OFFSET_GHCB as i64 * libc::sysconf(libc::_SC_PAGE_SIZE), ) }; - if addr == libc::MAP_FAILED { + if std::ptr::eq(addr, libc::MAP_FAILED) { // No point of continuing, without this mmap VMGEXIT will fail anyway // Return error return Err(vm::HypervisorVmError::MmapToRoot); diff --git a/pci/src/vfio.rs b/pci/src/vfio.rs index bad337f1e..4cf99de63 100644 --- a/pci/src/vfio.rs +++ b/pci/src/vfio.rs @@ -1613,7 +1613,7 @@ impl VfioPciDevice { ) }; - if host_addr == libc::MAP_FAILED { + if std::ptr::eq(host_addr, libc::MAP_FAILED) { error!( "Could not mmap sparse area (offset = 0x{:x}, size = 0x{:x}): {}", area.offset, diff --git a/pci/src/vfio_user.rs b/pci/src/vfio_user.rs index cde2aec08..b0e41a02c 100644 --- a/pci/src/vfio_user.rs +++ b/pci/src/vfio_user.rs @@ -169,7 +169,7 @@ impl VfioUserPciDevice { ) }; - if host_addr == libc::MAP_FAILED { + if std::ptr::eq(host_addr, libc::MAP_FAILED) { error!( "Could not mmap regions, error:{}", std::io::Error::last_os_error()