All of lore.kernel.org
 help / color / mirror / Atom feed
* [anolis-intel-cloud:devel-6.6 0/94] arch/x86/kvm/svm/csv.c:774:6: warning: variable 'pfn' is used uninitialized whenever 'if' condition is true
@ 2025-05-10  5:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-10  5:54 UTC (permalink / raw)
  To: aubrey.li; +Cc: oe-kbuild-all

tree:   https://gitee.com/anolis/intel-cloud-kernel.git devel-6.6
head:   a79e0786f3fa90fd521f198ac6ccf6b11dbf67c2
commit: c0bfce1e4fad37d7dd413e3ef813e18edd738d4f [0/94] anolis: KVM: SVM: CSV: Manage CSV3 guest's nested page table
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250510/202505101324.MRXaYYFi-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
rustc: rustc 1.73.0 (cc66ad468 2023-10-03)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250510/202505101324.MRXaYYFi-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/202505101324.MRXaYYFi-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/svm/csv.c:774:6: warning: variable 'pfn' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     774 |         if (error_code & PFERR_PRESENT_MASK)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/svm/csv.c:787:15: note: uninitialized use occurs here
     787 |                                 &psp_ret, pfn, level);
         |                                           ^~~
   arch/x86/kvm/svm/csv.c:774:2: note: remove the 'if' if its condition is always false
     774 |         if (error_code & PFERR_PRESENT_MASK)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     775 |                 level = CSV3_PG_LEVEL_4K;
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~
     776 |         else {
         |         ~~~~
   arch/x86/kvm/svm/csv.c:771:15: note: initialize the variable 'pfn' to silence this warning
     771 |         kvm_pfn_t pfn;
         |                      ^
         |                       = 0
   1 warning generated.


vim +774 arch/x86/kvm/svm/csv.c

   764	
   765	static int csv3_page_fault(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
   766				   gfn_t gfn, u32 error_code)
   767	{
   768		int ret = 0;
   769		int psp_ret = 0;
   770		int level;
   771		kvm_pfn_t pfn;
   772		struct kvm_csv_info *csv = &to_kvm_svm_csv(vcpu->kvm)->csv_info;
   773	
 > 774		if (error_code & PFERR_PRESENT_MASK)
   775			level = CSV3_PG_LEVEL_4K;
   776		else {
   777			mutex_lock(&csv->shared_page_block_lock);
   778			ret = csv3_pin_shared_memory(vcpu, slot, gfn, &pfn);
   779			mutex_unlock(&csv->shared_page_block_lock);
   780			if (ret)
   781				goto exit;
   782	
   783			level = csv3_mapping_level(vcpu, gfn, pfn, slot);
   784		}
   785	
   786		ret = __csv3_page_fault(vcpu, gfn << PAGE_SHIFT, error_code, slot,
   787					&psp_ret, pfn, level);
   788	
   789		if (psp_ret != SEV_RET_SUCCESS)
   790			ret = -EFAULT;
   791	exit:
   792		return ret;
   793	}
   794	

-- 
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:[~2025-05-10  5:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-10  5:54 [anolis-intel-cloud:devel-6.6 0/94] arch/x86/kvm/svm/csv.c:774:6: warning: variable 'pfn' is used uninitialized whenever 'if' condition is true kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.