Skip to contentSkip to conversation

correctly mask pmc index bits in RDPMC instruction emulation

PATCH Applied Gleb Natapov 2 participants 2 messages Feb 16, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 correctly mask pmc index bits in RDPMC instruction emulation

arch/x86/kvm/pmu.c +1 -1
index 7aad544..3e48c1d 100644
@@ -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)

--
Gleb.