Skip to content

Commit 8924f6d

Browse files
shiqingglijinxia
authored andcommitted
hv: vmx: fix 'Array has no bounds specified'
MISRAC requires that the array size should be declared explicitly. This patch fixes the issues caused by vm0_boot_context. Fix pattern is like below: extern char start_of_ROM, end_of_ROM, start_of_FLASH; memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM); Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
1 parent 6988a17 commit 8924f6d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id)
499499
#else
500500
if (is_vm0(vcpu->vm)) {
501501
struct boot_ctx *vm0_init_ctx =
502-
(struct boot_ctx *)vm0_boot_context;
502+
(struct boot_ctx *)(&vm0_boot_context);
503503
/* VM0 bsp start mode is decided by the boot context
504504
* setup by bootloader / bios */
505505
if ((vm0_init_ctx->ia32_efer & MSR_IA32_EFER_LMA_BIT) &&

hypervisor/arch/x86/vmx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ static void init_guest_context_vm0_bsp(struct vcpu *vcpu)
609609
{
610610
struct ext_context *ectx =
611611
&vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context].ext_ctx;
612-
struct boot_ctx * init_ctx = (struct boot_ctx *)vm0_boot_context;
612+
struct boot_ctx * init_ctx = (struct boot_ctx *)(&vm0_boot_context);
613613
uint16_t *sel;
614614
struct segment_sel *seg;
615615

@@ -709,7 +709,7 @@ static void init_guest_state(struct vcpu *vcpu)
709709
{
710710
struct cpu_context *ctx =
711711
&vcpu->arch_vcpu.contexts[vcpu->arch_vcpu.cur_context];
712-
struct boot_ctx * init_ctx = (struct boot_ctx *)vm0_boot_context;
712+
struct boot_ctx * init_ctx = (struct boot_ctx *)(&vm0_boot_context);
713713
enum vm_cpu_mode vcpu_mode = get_vcpu_mode(vcpu);
714714

715715
vcpu_set_rflags(vcpu, 0x2UL); /* Bit 1 is a active high reserved bit */

hypervisor/include/arch/x86/guest/guest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
141141
uint32_t size, uint32_t *err_code, uint64_t *fault_addr);
142142

143143
uint64_t create_guest_init_gdt(struct vm *vm, uint32_t *limit);
144-
extern uint8_t vm0_boot_context[];
144+
extern uint8_t vm0_boot_context;
145145

146146
#ifdef HV_DEBUG
147147
void get_req_info(char *str_arg, int str_max);

0 commit comments

Comments
 (0)