diff --git a/pci/src/vfio.rs b/pci/src/vfio.rs index de2948b33..5c2a7327e 100644 --- a/pci/src/vfio.rs +++ b/pci/src/vfio.rs @@ -1422,6 +1422,7 @@ impl VfioPciDevice { )?; for area in sparse_areas.iter() { + // SAFETY: FFI call with correct arguments let host_addr = unsafe { libc::mmap( null_mut(), @@ -1488,6 +1489,7 @@ impl VfioPciDevice { error!("Could not remove the userspace memory region: {}", e); } + // SAFETY: FFI call with correct arguments let ret = unsafe { libc::munmap( user_memory_region.host_addr as *mut libc::c_void, diff --git a/pci/src/vfio_user.rs b/pci/src/vfio_user.rs index 95c654196..6715c03f5 100644 --- a/pci/src/vfio_user.rs +++ b/pci/src/vfio_user.rs @@ -181,6 +181,7 @@ impl VfioUserPciDevice { }; for s in mmaps.iter() { + // SAFETY: FFI call with correct arguments let host_addr = unsafe { libc::mmap( null_mut(), @@ -247,6 +248,7 @@ impl VfioUserPciDevice { } // Remove mmaps + // SAFETY: FFI call with correct arguments let ret = unsafe { libc::munmap( user_memory_region.host_addr as *mut libc::c_void,