[bug report] KVM: x86/mmu: Skip rmap operations if rmaps not allocated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux