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)]
fn run(&self) -> std::result::Result<cpu::VmExit, cpu::HypervisorCpuError> {
// Safe because this is just only done during initialization.
// TODO don't zero it everytime we enter this function.
let hv_message: hv_message = unsafe { std::mem::zeroed() };
let hv_message: hv_message = hv_message::default();
match self.fd.run(hv_message) {
Ok(x) => match x.header.message_type {
hv_message_type_HVMSG_X64_HALT => {