aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-10-17 10:50:47 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2013-10-31 06:31:19 -0400
commitc67a04cb9aee0d6c0b27ab8f3f68668ed6b72897 (patch)
tree2c044ca0265cded83f7e1ef0958a55df31f08867 /arch/x86
parent46c34cb059d519601fb567b55cf45c300fea2928 (diff)
KVM: x86: fix KVM_SET_XCRS loop
The loop was always using 0 as the index. This means that any rubbish after the first element of the array went undetected. It seems reasonable to assume that no KVM userspace did that. Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 296154956399..6d16fc530246 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3064,9 +3064,9 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu,
3064 3064
3065 for (i = 0; i < guest_xcrs->nr_xcrs; i++) 3065 for (i = 0; i < guest_xcrs->nr_xcrs; i++)
3066 /* Only support XCR0 currently */ 3066 /* Only support XCR0 currently */
3067 if (guest_xcrs->xcrs[0].xcr == XCR_XFEATURE_ENABLED_MASK) { 3067 if (guest_xcrs->xcrs[i].xcr == XCR_XFEATURE_ENABLED_MASK) {
3068 r = __kvm_set_xcr(vcpu, XCR_XFEATURE_ENABLED_MASK, 3068 r = __kvm_set_xcr(vcpu, XCR_XFEATURE_ENABLED_MASK,
3069 guest_xcrs->xcrs[0].value); 3069 guest_xcrs->xcrs[i].value);
3070 break; 3070 break;
3071 } 3071 }
3072 if (r) 3072 if (r)