[kvm:tdp-mmu 57/57] arch/x86/kvm/mmu/mmu.c:3995:15: warning: variable 'root' is uninitialized when used here

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

 



tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git tdp-mmu
head:   1eb10c8be32298671cee78789ce32c3851f2e1f7
commit: 1eb10c8be32298671cee78789ce32c3851f2e1f7 [57/57] kvm: mmu: Support MMIO in the TDP MMU
config: x86_64-randconfig-a011-20201002 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bcd05599d0e53977a963799d6ee4f6e0bc21331b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=1eb10c8be32298671cee78789ce32c3851f2e1f7
        git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git
        git fetch --no-tags kvm tdp-mmu
        git checkout 1eb10c8be32298671cee78789ce32c3851f2e1f7
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/mmu/mmu.c:3995:15: warning: variable 'root' is uninitialized when used here [-Wuninitialized]
           for (level = root; level >= leaf; level--) {
                        ^~~~
   arch/x86/kvm/mmu/mmu.c:3978:10: note: initialize the variable 'root' to silence this warning
           int root;
                   ^
                    = 0
   1 warning generated.

vim +/root +3995 arch/x86/kvm/mmu/mmu.c

  3972	
  3973	/* return true if reserved bit is detected on spte. */
  3974	static bool get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep)
  3975	{
  3976		u64 sptes[PT64_ROOT_MAX_LEVEL];
  3977		struct rsvd_bits_validate *rsvd_check;
  3978		int root;
  3979		int leaf;
  3980		int level;
  3981		bool reserved = false;
  3982	
  3983		if (!VALID_PAGE(vcpu->arch.mmu->root_hpa)) {
  3984			*sptep = 0ull;
  3985			return reserved;
  3986		}
  3987	
  3988		if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa))
  3989			leaf = kvm_tdp_mmu_get_walk(vcpu, addr, sptes);
  3990		else
  3991			leaf = get_walk(vcpu, addr, sptes);
  3992	
  3993		rsvd_check = &vcpu->arch.mmu->shadow_zero_check;
  3994	
> 3995		for (level = root; level >= leaf; level--) {
  3996			if (!is_shadow_present_pte(sptes[level - 1]))
  3997				break;
  3998			/*
  3999			 * Use a bitwise-OR instead of a logical-OR to aggregate the
  4000			 * reserved bit and EPT's invalid memtype/XWR checks to avoid
  4001			 * adding a Jcc in the loop.
  4002			 */
  4003			reserved |= __is_bad_mt_xwr(rsvd_check, sptes[level - 1]) |
  4004				    __is_rsvd_bits_set(rsvd_check, sptes[level - 1],
  4005						       level);
  4006		}
  4007	
  4008		if (reserved) {
  4009			pr_err("%s: detect reserved bits on spte, addr 0x%llx, dump hierarchy:\n",
  4010			       __func__, addr);
  4011			for (level = root; level >= leaf; level--)
  4012				pr_err("------ spte 0x%llx level %d.\n",
  4013				       sptes[level - 1], level);
  4014		}
  4015	
  4016		*sptep = sptes[leaf - 1];
  4017	
  4018		return reserved;
  4019	}
  4020	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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