提交 d14eff1b 编写于 作者: G Gustavo A. R. Silva 提交者: 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: NGustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: NWei Yang <richardw.yang@linux.intel.com>
Reviewed-by: NLuwei Kang <luwei.kang@intel.com>
Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册