aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2025-10-21 17:34:11 +0000
committerMark Johnston <markj@FreeBSD.org>2025-10-21 17:34:11 +0000
commit14133abfe9c218b97e888edf04d2ec4a86e7ab4b (patch)
tree60b844395a38e26d4feb68072e8ac268d2b082f7 /sys/riscv
parent05637c82243e681b5db5d7e9829e699515456524 (diff)
Diffstat (limited to 'sys/riscv')
-rw-r--r--sys/riscv/vmm/vmm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/riscv/vmm/vmm.c b/sys/riscv/vmm/vmm.c
index 4c9b1fa53f7a..24b4be89af48 100644
--- a/sys/riscv/vmm/vmm.c
+++ b/sys/riscv/vmm/vmm.c
@@ -954,8 +954,7 @@ vcpu_get_state(struct vcpu *vcpu, int *hostcpu)
int
vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval)
{
-
- if (reg >= VM_REG_LAST)
+ if (reg < 0 || reg >= VM_REG_LAST)
return (EINVAL);
return (vmmops_getreg(vcpu->cookie, reg, retval));
@@ -966,7 +965,7 @@ vm_set_register(struct vcpu *vcpu, int reg, uint64_t val)
{
int error;
- if (reg >= VM_REG_LAST)
+ if (reg < 0 || reg >= VM_REG_LAST)
return (EINVAL);
error = vmmops_setreg(vcpu->cookie, reg, val);
if (error || reg != VM_REG_GUEST_SEPC)