From: Gleb Natapov Date: Wed, 9 May 2012 13:10:41 +0000 (+0300) Subject: KVM: x86 emulator: correctly mask pmc index bits in RDPMC instruction emulation X-Git-Tag: v3.3.6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1cca0b1b79ba339d040793ad70fad254e1af220;p=thirdparty%2Fkernel%2Fstable.git KVM: x86 emulator: correctly mask pmc index bits in RDPMC instruction emulation (cherry picked from commit 270c6c79f4e15e599f47174ecedad932463af7a2) Signed-off-by: Gleb Natapov Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 7aad5446f393d..3e48c1d3edcde 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -413,7 +413,7 @@ int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data) struct kvm_pmc *counters; u64 ctr; - pmc &= (3u << 30) - 1; + pmc &= ~(3u << 30); if (!fixed && pmc >= pmu->nr_arch_gp_counters) return 1; if (fixed && pmc >= pmu->nr_arch_fixed_counters)