diff --git a/hypervisor/arch/x86/guest/guest_memory.c b/hypervisor/arch/x86/guest/guest_memory.c index c3a217009..3cec47690 100644 --- a/hypervisor/arch/x86/guest/guest_memory.c +++ b/hypervisor/arch/x86/guest/guest_memory.c @@ -443,5 +443,6 @@ int32_t copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva, /* gpa --> hpa -->hva */ void *gpa2hva(struct acrn_vm *vm, uint64_t x) { - return hpa2hva(gpa2hpa(vm, x)); + uint64_t hpa = gpa2hpa(vm, x); + return (hpa == INVALID_HPA) ? NULL : hpa2hva(hpa); }