lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107262020.UobvBBnZ-lkp@intel.com>
Date:   Mon, 26 Jul 2021 15:48:42 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Vineeth Pillai <viremana@...ux.microsoft.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>
Subject: arch/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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ