linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arch/x86/kvm/svm/svm_onhyperv.h:73 svm_hv_vmcb_dirty_nested_enlightenments() warn: variable dereferenced before check 'vmcb' (see line 65)
@ 2021-07-26 12:48 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-07-26 12:48 UTC (permalink / raw)
  To: kbuild, Vineeth Pillai; +Cc: lkp, kbuild-all, linux-kernel, Paolo Bonzini

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ff1176468d368232b684f75e82563369208bc371
commit: c4327f15dfc7294b2abde0ea49b3e43eec3cca38 KVM: SVM: hyper-v: Enlightened MSR-Bitmap support
config: x86_64-randconfig-m001-20210726 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
arch/x86/kvm/svm/svm_onhyperv.h:73 svm_hv_vmcb_dirty_nested_enlightenments() warn: variable dereferenced before check 'vmcb' (see line 65)

vim +/vmcb +73 arch/x86/kvm/svm/svm_onhyperv.h

c4327f15dfc729 Vineeth Pillai 2021-06-03  60  static inline void svm_hv_vmcb_dirty_nested_enlightenments(
c4327f15dfc729 Vineeth Pillai 2021-06-03  61  		struct kvm_vcpu *vcpu)
c4327f15dfc729 Vineeth Pillai 2021-06-03  62  {
c4327f15dfc729 Vineeth Pillai 2021-06-03  63  	struct vmcb *vmcb = to_svm(vcpu)->vmcb;
c4327f15dfc729 Vineeth Pillai 2021-06-03  64  	struct hv_enlightenments *hve =
c4327f15dfc729 Vineeth Pillai 2021-06-03 @65  		(struct hv_enlightenments *)vmcb->control.reserved_sw;
                                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
Dereferenced

c4327f15dfc729 Vineeth Pillai 2021-06-03  66  
c4327f15dfc729 Vineeth Pillai 2021-06-03  67  	/*
c4327f15dfc729 Vineeth Pillai 2021-06-03  68  	 * vmcb can be NULL if called during early vcpu init.
c4327f15dfc729 Vineeth Pillai 2021-06-03  69  	 * And its okay not to mark vmcb dirty during vcpu init
c4327f15dfc729 Vineeth Pillai 2021-06-03  70  	 * as we mark it dirty unconditionally towards end of vcpu
c4327f15dfc729 Vineeth Pillai 2021-06-03  71  	 * init phase.
c4327f15dfc729 Vineeth Pillai 2021-06-03  72  	 */
c4327f15dfc729 Vineeth Pillai 2021-06-03 @73  	if (vmcb && vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) &&
                                                    ^^^^
Checked too late.

c4327f15dfc729 Vineeth Pillai 2021-06-03  74  	    hve->hv_enlightenments_control.msr_bitmap)
c4327f15dfc729 Vineeth Pillai 2021-06-03  75  		vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS);
c4327f15dfc729 Vineeth Pillai 2021-06-03  76  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

only message in thread, other threads:[~2021-07-26 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 12:48 arch/x86/kvm/svm/svm_onhyperv.h:73 svm_hv_vmcb_dirty_nested_enlightenments() warn: variable dereferenced before check 'vmcb' (see line 65) Dan Carpenter

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).