public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [intel-tdx:kvm-upstream-next 48/273] arch/x86/kvm/vmx/tdx.c:62:31: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first
@ 2023-11-20 11:45 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-11-20 11:45 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: llvm, oe-kbuild-all, Isaku Yamahata

tree:   https://github.com/intel/tdx.git kvm-upstream-next
head:   90fec84219b5d2bf13e61f02777f6a44ab755bc4
commit: 363d0103dd41d764bc8e4673457923a438c27cf8 [48/273] KVM: TDX: x86: Add ioctl to get TDX systemwide parameters
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231120/202311201906.rJwYHtwX-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231120/202311201906.rJwYHtwX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311201906.rJwYHtwX-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/vmx/tdx.c:62:31: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
                    cpu_has_vmx_ept_5levels()) ? TDX_CAP_GPAW_52 : 0,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   arch/x86/kvm/vmx/tdx.c:62:31: note: place parentheses around the '|' expression to silence this warning
                    cpu_has_vmx_ept_5levels()) ? TDX_CAP_GPAW_52 : 0,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   arch/x86/kvm/vmx/tdx.c:62:31: note: place parentheses around the '?:' expression to evaluate it first
                    cpu_has_vmx_ept_5levels()) ? TDX_CAP_GPAW_52 : 0,
                                               ^
                                                                    )
   1 warning generated.


vim +62 arch/x86/kvm/vmx/tdx.c

    27	
    28	static int tdx_get_capabilities(struct kvm_tdx_cmd *cmd)
    29	{
    30		struct kvm_tdx_capabilities __user *user_caps;
    31		struct kvm_tdx_capabilities *caps = NULL;
    32		int ret = 0;
    33	
    34		BUILD_BUG_ON(sizeof(struct kvm_tdx_cpuid_config) !=
    35			     sizeof(struct tdx_cpuid_config));
    36	
    37		if (cmd->flags)
    38			return -EINVAL;
    39	
    40		caps = kmalloc(sizeof(*caps), GFP_KERNEL);
    41		if (!caps)
    42			return -ENOMEM;
    43	
    44		user_caps = (void __user *)cmd->data;
    45		if (copy_from_user(caps, user_caps, sizeof(*caps))) {
    46			ret = -EFAULT;
    47			goto out;
    48		}
    49	
    50		if (caps->nr_cpuid_configs < tdx_info->num_cpuid_config) {
    51			ret = -E2BIG;
    52			goto out;
    53		}
    54	
    55		*caps = (struct kvm_tdx_capabilities) {
    56			.attrs_fixed0 = tdx_info->attributes_fixed0,
    57			.attrs_fixed1 = tdx_info->attributes_fixed1,
    58			.xfam_fixed0 = tdx_info->xfam_fixed0,
    59			.xfam_fixed1 = tdx_info->xfam_fixed1,
    60			.supported_gpaw = TDX_CAP_GPAW_48 |
    61			(kvm_get_shadow_phys_bits() >= 52 &&
  > 62			 cpu_has_vmx_ept_5levels()) ? TDX_CAP_GPAW_52 : 0,
    63			.nr_cpuid_configs = tdx_info->num_cpuid_config,
    64			.padding = 0,
    65		};
    66	
    67		if (copy_to_user(user_caps, caps, sizeof(*caps))) {
    68			ret = -EFAULT;
    69			goto out;
    70		}
    71		if (copy_to_user(user_caps->cpuid_configs, &tdx_info->cpuid_configs,
    72				 tdx_info->num_cpuid_config *
    73				 sizeof(struct tdx_cpuid_config))) {
    74			ret = -EFAULT;
    75		}
    76	
    77	out:
    78		/* kfree() accepts NULL. */
    79		kfree(caps);
    80		return ret;
    81	}
    82	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-20 11:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 11:45 [intel-tdx:kvm-upstream-next 48/273] arch/x86/kvm/vmx/tdx.c:62:31: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox