forked from Minki/linux
kvm: selftests: avoid type punning
Avoid warnings from -Wstrict-aliasing by using memcpy. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
be7fcf1d17
commit
3b339e2527
@ -142,7 +142,7 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
|
||||
vm_vaddr_t gva;
|
||||
TEST_ASSERT(run->mmio.is_write && run->mmio.len == 8,
|
||||
"Unexpected ucall exit mmio address access");
|
||||
gva = *(vm_vaddr_t *)run->mmio.data;
|
||||
memcpy(&gva, run->mmio.data, sizeof(gva));
|
||||
memcpy(uc, addr_gva2hva(vm, gva), sizeof(*uc));
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void set_revision_id_for_vmcs12(struct kvm_nested_state *state,
|
||||
u32 vmcs12_revision)
|
||||
{
|
||||
/* Set revision_id in vmcs12 to vmcs12_revision. */
|
||||
*(u32 *)(state->data) = vmcs12_revision;
|
||||
memcpy(state->data, &vmcs12_revision, sizeof(u32));
|
||||
}
|
||||
|
||||
void set_default_state(struct kvm_nested_state *state)
|
||||
|
Loading…
Reference in New Issue
Block a user