KVM: x86/vPMU: fix undefined shift in intel_pmu_refresh()
authorRadim Krčmář <rkrcmar@redhat.com>
Thu, 18 May 2017 17:37:31 +0000 (19:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jul 2017 12:40:31 +0000 (14:40 +0200)
commitf3c3ec96e5fb40b453693421577d446b5b22fc52
treeb247911fede196a83fe6d03ae391f5c535e44842
parent1eeb7942633225baad2f8465dd93a4fb72b4ec7f
KVM: x86/vPMU: fix undefined shift in intel_pmu_refresh()

commit 34b0dadbdf698f9b277a31b2747b625b9a75ea1f upstream.

Static analysis noticed that pmu->nr_arch_gp_counters can be 32
(INTEL_PMC_MAX_GENERIC) and therefore cannot be used to shift 'int'.

I didn't add BUILD_BUG_ON for it as we have a better checker.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 25462f7f5295 ("KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch")
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/pmu_intel.c