diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-05-20 12:02:16 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-05-24 21:27:05 +0200 |
commit | 3b339e2527a6db257fa8f2a4cab3c510432a98d5 (patch) | |
tree | 4c4be2152f9e4a925ccea293f2c4715428d79132 /tools/testing/selftests/kvm/lib/ucall.c | |
parent | KVM: selftests: Fix a condition in test_hv_cpuid() (diff) | |
download | linux-3b339e2527a6db257fa8f2a4cab3c510432a98d5.tar.xz linux-3b339e2527a6db257fa8f2a4cab3c510432a98d5.zip |
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>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/ucall.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/ucall.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/lib/ucall.c b/tools/testing/selftests/kvm/lib/ucall.c index a2ab38be2f47..b701a01cfcb6 100644 --- a/tools/testing/selftests/kvm/lib/ucall.c +++ b/tools/testing/selftests/kvm/lib/ucall.c @@ -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)); } |