kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: bgardon@google.com
Cc: kvm@vger.kernel.org
Subject: [bug report] KVM: x86/mmu: Skip rmap operations if rmaps not allocated
Date: Fri, 25 Jun 2021 12:50:35 +0300	[thread overview]
Message-ID: <YNWm623jLRMMDoNS@mwanda> (raw)

Hello Ben Gardon,

The patch e2209710ccc5: "KVM: x86/mmu: Skip rmap operations if rmaps
not allocated" from May 18, 2021, leads to the following static
checker warning:

	arch/x86/kvm/mmu/mmu.c:5704 kvm_mmu_zap_collapsible_sptes()
	error: uninitialized symbol 'flush'.

arch/x86/kvm/mmu/mmu.c
  5687  void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
  5688                                     const struct kvm_memory_slot *memslot)
  5689  {
  5690          /* FIXME: const-ify all uses of struct kvm_memory_slot.  */
  5691          struct kvm_memory_slot *slot = (struct kvm_memory_slot *)memslot;
  5692          bool flush;
                ^^^^^^^^^^
needs to be "bool flush = false;"

  5693  
  5694          if (kvm_memslots_have_rmaps(kvm)) {
  5695                  write_lock(&kvm->mmu_lock);
  5696                  flush = slot_handle_leaf(kvm, slot, kvm_mmu_zap_collapsible_spte, true);
  5697                  if (flush)
  5698                          kvm_arch_flush_remote_tlbs_memslot(kvm, slot);
  5699                  write_unlock(&kvm->mmu_lock);
  5700          }
  5701  
  5702          if (is_tdp_mmu_enabled(kvm)) {
  5703                  read_lock(&kvm->mmu_lock);
  5704                  flush = kvm_tdp_mmu_zap_collapsible_sptes(kvm, slot, flush);
                                                                             ^^^^^
Unintialized.

  5705                  if (flush)
  5706                          kvm_arch_flush_remote_tlbs_memslot(kvm, slot);
  5707                  read_unlock(&kvm->mmu_lock);
  5708          }
  5709  }

regards,
dan carpenter

             reply	other threads:[~2021-06-25  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25  9:50 Dan Carpenter [this message]
2021-07-01 16:33 ` [bug report] KVM: x86/mmu: Skip rmap operations if rmaps not allocated Ben Gardon

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=YNWm623jLRMMDoNS@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=bgardon@google.com \
    --cc=kvm@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).