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:
parent
b686a5bb24
commit
a64ba04e78
3 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue