On Mon, Jan 27, 2020 at 09:04:22AM +0300, Dan Carpenter wrote: > Hello Paolo Bonzini, > > The patch e71ae535bc24: "KVM: x86: avoid incorrect writes to host > MSR_IA32_SPEC_CTRL" from Jan 20, 2020, leads to the following static > checker warning: > > arch/x86/kvm/vmx/vmx.c:2001 vmx_set_msr() > warn: maybe use && instead of & > > arch/x86/kvm/vmx/vmx.c > 1994 vmx->msr_ia32_umwait_control = data; > 1995 break; > 1996 case MSR_IA32_SPEC_CTRL: > 1997 if (!msr_info->host_initiated && > 1998 !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) > 1999 return 1; > 2000 > 2001 if (data & ~kvm_spec_ctrl_valid_bits(vcpu)) > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > This seems wrong. kvm_spec_ctrl_valid_bits() returns a bool so this > is either 0xffffffff or 0xfffffffe. data is a u64. > > 2002 return 1; > 2003 > 2004 vmx->spec_ctrl = data; > 2005 if (!data) > 2006 break; > 2007 > 2008 /* > 2009 * For non-nested: Paolo already had to put on the cone of shame for this one :-) https://lkml.kernel.org/r/6b725990-f0c2-6577-be7e-44e101e540b5@xxxxxxxxxx