hypervisor: 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:
Julian Schindel
2026-04-29 21:55:06 +02:00
committed by Rob Bradford
parent 2a6b746f5e
commit 9b0d4b20ea
8 changed files with 32 additions and 34 deletions

View File

@@ -1961,7 +1961,7 @@ impl vm::Vm for MshvVm {
// Return error
return Err(vm::HypervisorVmError::MmapToRoot);
}
Some(Ghcb(addr as *mut svm_ghcb_base))
Some(Ghcb(addr.cast()))
} else {
None
};