mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: 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
cb09c37c55
commit
8b101fb890
+1
-1
@@ -1278,7 +1278,7 @@ mod tests {
|
||||
// safe to read. Casting to `u8` satisfies alignment requirements.
|
||||
let bytes = unsafe {
|
||||
std::slice::from_raw_parts(
|
||||
&gi as *const GenericInitiatorAffinity as *const u8,
|
||||
(&raw const gi).cast::<u8>(),
|
||||
std::mem::size_of::<GenericInitiatorAffinity>(),
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user