From: kernel test robot <lkp@intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Isaku Yamahata <isaku.yamahata@intel.com>
Subject: [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
Date: Mon, 20 Nov 2023 19:45:41 +0800 [thread overview]
Message-ID: <202311201906.rJwYHtwX-lkp@intel.com> (raw)
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
reply other threads:[~2023-11-20 11:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311201906.rJwYHtwX-lkp@intel.com \
--to=lkp@intel.com \
--cc=isaku.yamahata@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sean.j.christopherson@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox