From 4618a6b17d0417acff607cacd2a952171efe5b35 Mon Sep 17 00:00:00 2001 From: Shiqing Gao Date: Tue, 18 Dec 2018 15:15:45 +0800 Subject: [PATCH] hv: vmcs: fix MISRA-C violations related to pointer This patch fixes the MISRA-C violations in arch/x86/vmcs.c and arch/x86/vmx.c. * add the required 'const' for pointer param if the object pointed by the pointer is not modified * remove the unnecessary cast on pointer Tracked-On: #861 Signed-off-by: Shiqing Gao Acked-by: Eddie Dong --- hypervisor/arch/x86/vmcs.c | 2 +- hypervisor/arch/x86/vmx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/vmcs.c b/hypervisor/arch/x86/vmcs.c index faa87bb73..1de22347f 100644 --- a/hypervisor/arch/x86/vmcs.c +++ b/hypervisor/arch/x86/vmcs.c @@ -814,7 +814,7 @@ static void init_entry_ctrl(const struct acrn_vcpu *vcpu) exec_vmwrite32(VMX_ENTRY_INSTR_LENGTH, 0U); } -static void init_exit_ctrl(struct acrn_vcpu *vcpu) +static void init_exit_ctrl(const struct acrn_vcpu *vcpu) { uint32_t value32; diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c index 0797788ab..8cd1bd6a9 100644 --- a/hypervisor/arch/x86/vmx.c +++ b/hypervisor/arch/x86/vmx.c @@ -43,7 +43,7 @@ void vmx_on(void) /* Initialize vmxon page with revision id from IA32 VMX BASIC MSR */ tmp32 = (uint32_t)msr_read(MSR_IA32_VMX_BASIC); - (void)memcpy_s((uint32_t *) vmxon_region_va, 4U, (void *)&tmp32, 4U); + (void)memcpy_s(vmxon_region_va, 4U, (void *)&tmp32, 4U); /* Turn on CR0.NE and CR4.VMXE */ CPU_CR_READ(cr0, &tmp64);