hv: return error code for default case in hcall_vm_intr_monitor

In hcall_vm_intr_monitor(), the default case for intr_hdr->cmd is a
wrong case. So, it should return error code back. But it returns success
code 0 in current codes.

Tracked-On: #8580
Reviewed-by: Fei Li <fei1.li@intel.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
This commit is contained in:
Yi Sun 2024-04-17 14:10:10 +08:00 committed by acrnsi-robot
parent 7bcd9d783e
commit e0d03b27d0
1 changed files with 3 additions and 2 deletions

View File

@ -1208,6 +1208,8 @@ int32_t hcall_vm_intr_monitor(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm,
intr_hdr = (struct acrn_intr_monitor *)hpa2hva(hpa); intr_hdr = (struct acrn_intr_monitor *)hpa2hva(hpa);
stac(); stac();
if (intr_hdr->buf_cnt <= (MAX_PTDEV_NUM * 2U)) { if (intr_hdr->buf_cnt <= (MAX_PTDEV_NUM * 2U)) {
status = 0;
switch (intr_hdr->cmd) { switch (intr_hdr->cmd) {
case INTR_CMD_GET_DATA: case INTR_CMD_GET_DATA:
intr_hdr->buf_cnt = ptirq_get_intr_data(target_vm, intr_hdr->buf_cnt = ptirq_get_intr_data(target_vm,
@ -1222,10 +1224,9 @@ int32_t hcall_vm_intr_monitor(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm,
default: default:
/* if cmd wrong it goes here should not happen */ /* if cmd wrong it goes here should not happen */
status = -EINVAL;
break; break;
} }
status = 0;
} }
clac(); clac();
} }