1
0
mirror of https://github.com/cloud-hypervisor/cloud-hypervisor.git synced 2025-03-20 07:58:55 +00:00

hypervisor: mshv: drop one unsafe in code

The binding already provides a default() method which does the same
thing.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2021-09-20 14:32:41 +00:00 committed by Sebastien Boeuf
parent ae68c802bd
commit 86afa38c64

View File

@ -288,9 +288,7 @@ impl cpu::Vcpu for MshvVcpu {
} }
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
fn run(&self) -> std::result::Result<cpu::VmExit, cpu::HypervisorCpuError> { fn run(&self) -> std::result::Result<cpu::VmExit, cpu::HypervisorCpuError> {
// Safe because this is just only done during initialization. let hv_message: hv_message = hv_message::default();
// TODO don't zero it everytime we enter this function.
let hv_message: hv_message = unsafe { std::mem::zeroed() };
match self.fd.run(hv_message) { match self.fd.run(hv_message) {
Ok(x) => match x.header.message_type { Ok(x) => match x.header.message_type {
hv_message_type_HVMSG_X64_HALT => { hv_message_type_HVMSG_X64_HALT => {