mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
pci: add safety comments
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
d1b9d9d7f7
commit
c5bd8cabc4
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user