* [dcui-tdx:decui/upstream-hyperv/hyperv-next/TDX/0810 2/25] arch/x86/hyperv/hv_init.c:392:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2023-08-11 5:12 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-08-11 5:12 UTC (permalink / raw)
To: Dexuan Cui; +Cc: llvm, oe-kbuild-all, Michael Kelley, Tianyu Lan
tree: https://github.com/dcui/tdx decui/upstream-hyperv/hyperv-next/TDX/0810
head: 104f836a5da361eec57916007c24e43c4d247951
commit: 4663943bdbd128de739f3d4d4ca9b7a55f7cdac3 [2/25] [PATCH V5 2/8] x86/hyperv: Set Virtual Trust Level in VMBus init message
config: x86_64-buildonly-randconfig-r003-20230811 (https://download.01.org/0day-ci/archive/20230811/202308111314.Ze67fL6a-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308111314.Ze67fL6a-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/202308111314.Ze67fL6a-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> arch/x86/hyperv/hv_init.c:392:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!input) {
^~~~~~
arch/x86/hyperv/hv_init.c:413:9: note: uninitialized use occurs here
return ret;
^~~
arch/x86/hyperv/hv_init.c:392:2: note: remove the 'if' if its condition is always false
if (!input) {
^~~~~~~~~~~~~
arch/x86/hyperv/hv_init.c:387:9: note: initialize the variable 'ret' to silence this warning
u64 ret;
^
= 0
1 warning generated.
vim +392 arch/x86/hyperv/hv_init.c
380
381 static u8 __init get_vtl(void)
382 {
383 u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
384 struct hv_get_vp_registers_input *input;
385 struct hv_get_vp_registers_output *output;
386 unsigned long flags;
387 u64 ret;
388
389 local_irq_save(flags);
390 input = *this_cpu_ptr(hyperv_pcpu_input_arg);
391 output = (struct hv_get_vp_registers_output *)input;
> 392 if (!input) {
393 local_irq_restore(flags);
394 goto done;
395 }
396
397 memset(input, 0, struct_size(input, element, 1));
398 input->header.partitionid = HV_PARTITION_ID_SELF;
399 input->header.vpindex = HV_VP_INDEX_SELF;
400 input->header.inputvtl = 0;
401 input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS;
402
403 ret = hv_do_hypercall(control, input, output);
404 if (hv_result_success(ret)) {
405 ret = output->as64.low & HV_X64_VTL_MASK;
406 } else {
407 pr_err("Failed to get VTL and set VTL to zero by default.\n");
408 ret = 0;
409 }
410
411 local_irq_restore(flags);
412 done:
413 return ret;
414 }
415
--
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-08-11 5:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 5:12 [dcui-tdx:decui/upstream-hyperv/hyperv-next/TDX/0810 2/25] arch/x86/hyperv/hv_init.c:392:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true 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;
as well as URLs for NNTP newsgroup(s).