x86/hvm: fix off-by-one errors in vcpuid range checks
PATCH 1/1 x86/hvm: fix off-by-one errors in vcpuid range checks
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/hvm/hvm.c +1 -1
@@ -503,7 +503,7 @@ static int hvm_load_cpu_ctxt(struct doma/* Which vcpu is this? */ vcpuid =hvm_load_instance (h); -if ( vcpuid >MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) +if ( vcpuid >=MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) {gdprintk (XENLOG_ERR ,"HVM restore: domain has no vcpu %u\n" , vcpuid);return -EINVAL ;
xen/arch/x86/hvm/mtrr.c +1 -1
@@ -676,7 +676,7 @@ static int hvm_load_mtrr_msr(struct domastruct hvm_hw_mtrr hw_mtrr; vcpuid =hvm_load_instance (h); -if ( vcpuid >MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) +if ( vcpuid >=MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) {gdprintk (XENLOG_ERR ,"HVM restore: domain has no vcpu %u\n" , vcpuid);return -EINVAL ;
xen/arch/x86/hvm/vlapic.c +2 -2
@@ -913,7 +913,7 @@ static int lapic_load_hidden(struct doma/* Which vlapic to load? */ vcpuid =hvm_load_instance (h); -if ( vcpuid >MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) +if ( vcpuid >=MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) {gdprintk (XENLOG_ERR ,"HVM restore: domain has no vlapic %u\n" , vcpuid);return -EINVAL ;
@@ -936,7 +936,7 @@ static int lapic_load_regs(struct domain/* Which vlapic to load? */ vcpuid =hvm_load_instance (h); -if ( vcpuid >MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) +if ( vcpuid >=MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) ==NULL ) {gdprintk (XENLOG_ERR ,"HVM restore: domain has no vlapic %u\n" , vcpuid);return -EINVAL ;