lkml.org 
[lkml]   [2021]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectarch/x86/kvm/svm/svm_onhyperv.h:73 svm_hv_vmcb_dirty_nested_enlightenments() warn: variable dereferenced before check 'vmcb' (see line 65)
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

\
 
 \ /
  Last update: 2021-07-26 14:50    [W:0.371 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site