public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Vineeth Pillai <viremana@linux.microsoft.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.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)
Date: Mon, 26 Jul 2021 15:48:42 +0300	[thread overview]
Message-ID: <202107262020.UobvBBnZ-lkp@intel.com> (raw)

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


                 reply	other threads:[~2021-07-26 12:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107262020.UobvBBnZ-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=viremana@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox