mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vm-migration: add two safety comments
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
926d149881
commit
2a5c248f32
@ -257,6 +257,7 @@ impl MemoryRangeTable {
|
||||
length as usize / (std::mem::size_of::<MemoryRange>()),
|
||||
Default::default,
|
||||
);
|
||||
// SAFETY: the slice is construted with the correct arguments
|
||||
fd.read_exact(unsafe {
|
||||
std::slice::from_raw_parts_mut(
|
||||
data.as_ptr() as *mut MemoryRange as *mut u8,
|
||||
@ -273,6 +274,7 @@ impl MemoryRangeTable {
|
||||
}
|
||||
|
||||
pub fn write_to(&self, fd: &mut dyn Write) -> Result<(), MigratableError> {
|
||||
// SAFETY: the slice is construted with the correct arguments
|
||||
fd.write_all(unsafe {
|
||||
std::slice::from_raw_parts(
|
||||
self.data.as_ptr() as *const MemoryRange as *const u8,
|
||||
|
Loading…
Reference in New Issue
Block a user