Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Commit e178418

Browse files
authored
Merge pull request #282 from intel/cpuid-fixing
vcpu: Fix an issue of pointer checking
2 parents 396bba3 + 8a0c1af commit e178418

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: core/vcpu.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -4503,7 +4503,11 @@ static void vcpu_init_cpuid(struct vcpu_t *vcpu)
45034503

45044504
if (vcpu->vcpu_id != 0) {
45054505
vcpu_0 = hax_get_vcpu(vcpu->vm->vm_id, 0, 0);
4506-
hax_assert(vcpu_0 != NULL);
4506+
if (vcpu_0 == NULL) {
4507+
hax_log(HAX_LOGE, "%s: initializing vCPU #%u with exception as "
4508+
"vCPU #0 is absent.\n", __func__, vcpu->vcpu_id);
4509+
return;
4510+
}
45074511
vcpu->guest_cpuid = vcpu_0->guest_cpuid;
45084512
hax_log(HAX_LOGI, "%s: referenced vcpu[%u].guest_cpuid to vcpu[%u].\n",
45094513
__func__, vcpu->vcpu_id, vcpu_0->vcpu_id);

0 commit comments

Comments
 (0)