mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Fix clippy warning while comparing raw pointers
Use the builtin function instead of using `==` operator.
Warning from the beta compiler:
error: use `std::ptr::eq` when comparing raw pointers
--> pci/src/vfio.rs:1616:24
if host_addr == libc::MAP_FAILED {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: try: `std::ptr::eq(host_addr, libc::MAP_FAILED)`
= help: for further information visit
= https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
= note: `-D clippy::ptr-eq` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`
Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
@@ -1813,7 +1813,7 @@ impl vm::Vm for MshvVm {
|
|||||||
MSHV_VP_MMAP_OFFSET_GHCB as i64 * libc::sysconf(libc::_SC_PAGE_SIZE),
|
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
|
// No point of continuing, without this mmap VMGEXIT will fail anyway
|
||||||
// Return error
|
// Return error
|
||||||
return Err(vm::HypervisorVmError::MmapToRoot);
|
return Err(vm::HypervisorVmError::MmapToRoot);
|
||||||
|
|||||||
+1
-1
@@ -1613,7 +1613,7 @@ impl VfioPciDevice {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
if host_addr == libc::MAP_FAILED {
|
if std::ptr::eq(host_addr, libc::MAP_FAILED) {
|
||||||
error!(
|
error!(
|
||||||
"Could not mmap sparse area (offset = 0x{:x}, size = 0x{:x}): {}",
|
"Could not mmap sparse area (offset = 0x{:x}, size = 0x{:x}): {}",
|
||||||
area.offset,
|
area.offset,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ impl VfioUserPciDevice {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
if host_addr == libc::MAP_FAILED {
|
if std::ptr::eq(host_addr, libc::MAP_FAILED) {
|
||||||
error!(
|
error!(
|
||||||
"Could not mmap regions, error:{}",
|
"Could not mmap regions, error:{}",
|
||||||
std::io::Error::last_os_error()
|
std::io::Error::last_os_error()
|
||||||
|
|||||||
Reference in New Issue
Block a user