Skip to content

Commit 03ae242

Browse files
yonghuahlijinxia
authored andcommitted
HV:initialize variables before reference in vmx.c
- to avoid complains from code static scan tool Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
1 parent ccc1c25 commit 03ae242

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hypervisor/arch/x86/vmx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static void init_guest_state(struct vcpu *vcpu)
372372
/* Limit */
373373
limit = 0xFFFF;
374374
} else if (get_vcpu_mode(vcpu) == PAGE_PROTECTED_MODE) {
375-
descriptor_table gdtb;
375+
descriptor_table gdtb = {0, 0};
376376

377377
/* Base *//* TODO: Should guest GDTB point to host GDTB ? */
378378
/* Obtain the current global descriptor table base */
@@ -407,7 +407,7 @@ static void init_guest_state(struct vcpu *vcpu)
407407
/* Limit */
408408
limit = 0xFFFF;
409409
} else if (get_vcpu_mode(vcpu) == PAGE_PROTECTED_MODE) {
410-
descriptor_table idtb ;
410+
descriptor_table idtb = {0, 0};
411411

412412
/* TODO: Should guest IDTR point to host IDTR ? */
413413
asm volatile ("sidt %0"::"m" (idtb));
@@ -660,8 +660,8 @@ static void init_host_state(__unused struct vcpu *vcpu)
660660
uint64_t trbase_lo;
661661
uint64_t trbase_hi;
662662
uint64_t realtrbase;
663-
descriptor_table gdtb;
664-
descriptor_table idtb;
663+
descriptor_table gdtb = {0, 0};
664+
descriptor_table idtb = {0, 0};
665665
uint16_t tr_sel;
666666

667667
pr_dbg("*********************");

0 commit comments

Comments
 (0)