Skip to content

Commit eb77e25

Browse files
shiqinggwenlingz
authored andcommitted
hv: ept: fix MISRA-C violations
This patch fixes the MISRA-C violations in arch/x86/ept.c * add local variable if the input parameter passed by value is changed in function definition * remove the duplicated semi colon Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 5253ac7 commit eb77e25

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hypervisor/arch/x86/ept.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int32_t ept_violation_vmexit_handler(struct acrn_vcpu *vcpu)
125125
if (mmio_req->direction == REQUEST_WRITE) {
126126
status = emulate_instruction(vcpu);
127127
if (status != 0) {
128-
ret = -EFAULT;;
128+
ret = -EFAULT;
129129
}
130130
}
131131

@@ -204,14 +204,15 @@ void ept_mr_modify(struct acrn_vm *vm, uint64_t *pml4_page,
204204
{
205205
struct acrn_vcpu *vcpu;
206206
uint16_t i;
207+
uint64_t local_prot = prot_set;
207208

208209
dev_dbg(ACRN_DBG_EPT, "%s,vm[%d] gpa 0x%llx size 0x%llx\n", __func__, vm->vm_id, gpa, size);
209210

210-
if (((prot_set & EPT_MT_MASK) != EPT_UNCACHED) && vm->snoopy_mem) {
211-
prot_set |= EPT_SNOOP_CTRL;
211+
if (((local_prot & EPT_MT_MASK) != EPT_UNCACHED) && vm->snoopy_mem) {
212+
local_prot |= EPT_SNOOP_CTRL;
212213
}
213214

214-
mmu_modify_or_del(pml4_page, gpa, size, prot_set, prot_clr, &vm->arch_vm.ept_mem_ops, MR_MODIFY);
215+
mmu_modify_or_del(pml4_page, gpa, size, local_prot, prot_clr, &(vm->arch_vm.ept_mem_ops), MR_MODIFY);
215216

216217
foreach_vcpu(i, vm, vcpu) {
217218
vcpu_make_request(vcpu, ACRN_REQUEST_EPT_FLUSH);

0 commit comments

Comments
 (0)