mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-migration: replace as <pointer> casts with safer alternatives
`as` casts can change mutability, which quickly leads to undefined behavior. Signed-off-by: Julian Schindel <mail@arctic-alpaca.de>
This commit is contained in:
committed by
Rob Bradford
parent
8abd9d7db5
commit
cb09c37c55
@@ -444,7 +444,7 @@ impl MemoryRangeTable {
|
||||
pub fn write_to(&self, fd: &mut dyn Write) -> Result<(), MigratableError> {
|
||||
// SAFETY: the slice is constructed with the correct arguments
|
||||
fd.write_all(unsafe {
|
||||
std::slice::from_raw_parts(self.data.as_ptr() as *const u8, self.length() as usize)
|
||||
std::slice::from_raw_parts(self.data.as_ptr().cast(), self.length() as usize)
|
||||
})
|
||||
.map_err(MigratableError::MigrateSocket)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user