Commit d14eff1b authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Radim Krčmář

KVM: x86: Fix bit shifting in update_intel_pt_cfg

ctl_bitmask in pt_desc is of type u64. When an integer like 0xf is
being left shifted more than 32 bits, the behavior is undefined.

Fix this by adding suffix ULL to integer 0xf.

Addresses-Coverity-ID: 1476095 ("Bad bit shift operation")
Fixes: 6c0f0bba ("KVM: x86: Introduce a function to initialize the PT configuration")
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: default avatarWei Yang <richardw.yang@linux.intel.com>
Reviewed-by: default avatarLuwei Kang <luwei.kang@intel.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent bfeffd15
......@@ -7044,7 +7044,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu)
/* unmask address range configure area */
for (i = 0; i < vmx->pt_desc.addr_range; i++)
vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4));
vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4));
}
static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment