All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-01-09  7:41 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-01-09  7:41 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 24201 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Paolo Bonzini <pbonzini@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4634129ad9fdc89d10b597fc6f8f4336fb61e105
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs outside mmu_lock
date:   9 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 9 months ago
config: x86_64-randconfig-c007-20220108 (https://download.01.org/0day-ci/archive/20220109/202201091550.h0I2DQ8I-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f3a344d2125fa37e59bae1b0874442c650a19607)
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
                         ^
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 'shadow_acc_track_mask' is not equal to 0
           return shadow_acc_track_mask != 0 ||
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:36: note: Left side of '||' is true
           return shadow_acc_track_mask != 0 ||
                                             ^
   arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which participates in a condition later
           return shadow_acc_track_mask != 0 ||
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 'page_fault_can_be_fast'
           if (!page_fault_can_be_fast(error_code))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
           if (!page_fault_can_be_fast(error_code))
           ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not equal to PT64_ROOT_4LEVEL
           if (iterator->level == PT64_ROOT_4LEVEL &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
           if (iterator->level == PT64_ROOT_4LEVEL &&
                                                   ^
   arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not equal to PT32E_ROOT_LEVEL
           if (iterator->level == PT32E_ROOT_LEVEL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
           if (iterator->level == PT32E_ROOT_LEVEL) {
           ^
   arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < PG_LEVEL_4K
           if (iterator->level < PG_LEVEL_4K)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
           if (iterator->level < PG_LEVEL_4K)
           ^
   arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 'iterator->sptep'
                   return false;
                   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                                             ^
   arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                   if (!is_shadow_present_pte(spte))
                   ^
   arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                           break;
                           ^
   arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is an uninitialized value
           trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, iterator.sptep,
           ^                                                   ~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                           r = -EIO;
                           ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                           r = -EIO;
                           ^   ~~~~
   Suppressed 7 warnings (6 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   Suppressed 3 warnings (3 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   drivers/mtd/ftl.c:177:26: warning: The left operand of '!=' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
       if (header.BlockSize != 9 ||
                            ^
   drivers/mtd/ftl.c:1012:6: note: Assuming 'partition' is non-null
           if (!partition) {
               ^~~~~~~~~~
   drivers/mtd/ftl.c:1012:2: note: Taking false branch
           if (!partition) {
           ^
   drivers/mtd/ftl.c:1020:7: note: Calling 'scan_header'
           if ((scan_header(partition) == 0) &&
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/ftl.c:158:19: note: Assuming 1048576 is >= field 'size'
       max_offset = (0x100000<part->mbd.mtd->size)?0x100000:part->mbd.mtd->size;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/ftl.c:158:18: note: '?' condition is false
       max_offset = (0x100000<part->mbd.mtd->size)?0x100000:part->mbd.mtd->size;
                    ^
   drivers/mtd/ftl.c:161:3: note: Assuming the condition is false
            (offset + sizeof(header)) < max_offset;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/ftl.c:160:5: note: Loop condition is false. Execution continues on line 173
       for (offset = 0;

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3288  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3297  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3300  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3303  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3305  	 * On SVM, reading PDPTRs might access guest memory, which might fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3313  
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3318  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3323  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02  3334  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 @3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3339  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3342  	 * or a PAE 3-level page table. In either case we need to be aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3348  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3353  
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3356  
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3359  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26  3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04  3367  
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3372  
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3377  
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22  3382  
8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti     2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385  

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-11-24  0:54 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-11-24  0:54 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 23096 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Paolo Bonzini <pbonzini@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5d9f4cf36721aba199975a9be7863a3ff5cd4b59
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs outside mmu_lock
date:   7 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 7 months ago
config: x86_64-randconfig-c007-20211122 (https://download.01.org/0day-ci/archive/20211124/202111240852.VioBRfTz-lkp(a)intel.com/config.gz)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c133fb321f7ca6083ce15b6aa5bf89de6600e649)
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
                         ^
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 'shadow_acc_track_mask' is equal to 0
           return shadow_acc_track_mask != 0 ||
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Left side of '||' is false
   arch/x86/kvm/mmu/mmu.c:2986:10: note: Assuming the condition is true
                  ((error_code & (PFERR_WRITE_MASK | PFERR_PRESENT_MASK))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which participates in a condition later
           return shadow_acc_track_mask != 0 ||
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 'page_fault_can_be_fast'
           if (!page_fault_can_be_fast(error_code))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
           if (!page_fault_can_be_fast(error_code))
           ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not equal to PT64_ROOT_4LEVEL
           if (iterator->level == PT64_ROOT_4LEVEL &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
           if (iterator->level == PT64_ROOT_4LEVEL &&
                                                   ^
   arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not equal to PT32E_ROOT_LEVEL
           if (iterator->level == PT32E_ROOT_LEVEL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
           if (iterator->level == PT32E_ROOT_LEVEL) {
           ^
   arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < PG_LEVEL_4K
           if (iterator->level < PG_LEVEL_4K)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
           if (iterator->level < PG_LEVEL_4K)
           ^
   arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 'iterator->sptep'
                   return false;
                   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                                             ^
   arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                   if (!is_shadow_present_pte(spte))
                   ^
   arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                           break;
                           ^
   arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is an uninitialized value
           trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, iterator.sptep,
           ^                                                   ~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                           r = -EIO;
                           ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                           r = -EIO;
                           ^   ~~~~
   Suppressed 7 warnings (6 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   lib/string_helpers.c:111:12: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           remainder += rounding[j];
                     ^  ~~~~~~~~~~~
   lib/string_helpers.c:59:6: note: Assuming 'blk_size' is not equal to 0
           if (blk_size == 0)
               ^~~~~~~~~~~~~
   lib/string_helpers.c:59:2: note: Taking false branch
           if (blk_size == 0)
           ^
   lib/string_helpers.c:61:6: note: Assuming 'size' is not equal to 0
           if (size == 0)
               ^~~~~~~~~
   lib/string_helpers.c:61:2: note: Taking false branch
           if (size == 0)
           ^
   lib/string_helpers.c:75:2: note: Loop condition is false. Execution continues on line 80
           while (blk_size >> 32) {
           ^
   lib/string_helpers.c:80:2: note: Loop condition is false. Execution continues on line 87
           while (size >> 32) {
           ^
   lib/string_helpers.c:90:2: note: Loop condition is false. Execution continues on line 97
           while (size >= divisor[units]) {
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:14: note: Assuming the condition is true
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is true.  Entering loop body
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:98:32: note: The value 3 is assigned to 'j'
           for (j = 0; sf_cap*10 < 1000; j++)
                                         ^~~
   lib/string_helpers.c:98:14: note: Assuming the condition is false
           for (j = 0; sf_cap*10 < 1000; j++)
                       ^~~~~~~~~~~~~~~~
   lib/string_helpers.c:98:2: note: Loop condition is false. Execution continues on line 101
           for (j = 0; sf_cap*10 < 1000; j++)
           ^
   lib/string_helpers.c:101:6: note: Assuming 'units' is not equal to STRING_UNITS_2
           if (units == STRING_UNITS_2) {
               ^~~~~~~~~~~~~~~~~~~~~~~
   lib/string_helpers.c:101:2: note: Taking false branch
           if (units == STRING_UNITS_2) {
           ^
   lib/string_helpers.c:111:12: note: Assigned value is garbage or undefined
           remainder += rounding[j];
                     ^  ~~~~~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   lib/kunit/test.c:371:23: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                                   if (param_desc[0] == '\0') {
                                                     ^
   lib/kunit/test.c:410:14: note: Assuming the condition is true
           for (i = 0; suites[i] != NULL; i++) {
                       ^~~~~~~~~~~~~~~~~
   lib/kunit/test.c:410:2: note: Loop condition is true.  Entering loop body
           for (i = 0; suites[i] != NULL; i++) {
           ^
   lib/kunit/test.c:412:3: note: Calling 'kunit_run_tests'
                   kunit_run_tests(suites[i]);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/test.c:356:2: note: Loop condition is true.  Entering loop body
           kunit_suite_for_each_test_case(suite, test_case) {
           ^
   include/kunit/test.h:349:2: note: expanded from macro 'kunit_suite_for_each_test_case'
           for (test_case = suite->test_cases; test_case->run_case; test_case++)
           ^
   lib/kunit/test.c:360:7: note: Assuming field 'generate_params' is null
                   if (test_case->generate_params) {

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3288  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3297  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3300  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3303  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3305  	 * On SVM, reading PDPTRs might access guest memory, which might fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3313  
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3318  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3323  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02  3334  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 @3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3339  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3342  	 * or a PAE 3-level page table. In either case we need to be aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3348  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3353  
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3356  
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3359  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26  3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04  3367  
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3372  
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3377  
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22  3382  
8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti     2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385  

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
  2021-08-08 15:21 kernel test robot
@ 2021-08-09 10:49   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-08-09 10:49 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: clang-built-linux, kbuild-all, LKML

[-- Attachment #1: Type: text/plain, Size: 23128 bytes --]


tree: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   85a90500f9a1717c4e142ce92e6c1cb1a339ec78
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs 
outside mmu_lock
date:   4 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-c001-20210806 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
42b9c2a17a0b63cccf3ac197a82f91b28e53e643)
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/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
         git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
         git fetch --no-tags linus master
         git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 
ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
    arch/x86/kvm/mmu/mmu.c:2963:2: note: Taking false branch
            if (unlikely(error_code & PFERR_RSVD_MASK))
            ^
    arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
            if (unlikely(((error_code & (PFERR_FETCH_MASK | 
PFERR_PRESENT_MASK))
                          ^
    include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
    # define unlikely(x)    __builtin_expect(!!(x), 0)
                                                ^
    arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
            if (unlikely(((error_code & (PFERR_FETCH_MASK | 
PFERR_PRESENT_MASK))
            ^
    arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 
'shadow_acc_track_mask' is equal to 0
            return shadow_acc_track_mask != 0 ||
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2985:9: note: Left side of '||' is false
    arch/x86/kvm/mmu/mmu.c:2986:10: note: Assuming the condition is true
                   ((error_code & (PFERR_WRITE_MASK | PFERR_PRESENT_MASK))
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which 
participates in a condition later
            return shadow_acc_track_mask != 0 ||
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 
'page_fault_can_be_fast'
            if (!page_fault_can_be_fast(error_code))
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
            if (!page_fault_can_be_fast(error_code))
            ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
            for (shadow_walk_init(&(_walker), _vcpu, _addr); 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 
'shadow_walk_init_using_root'
            shadow_walk_init_using_root(iterator, vcpu, 
vcpu->arch.mmu->root_hpa,
 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not 
equal to PT64_ROOT_4LEVEL
            if (iterator->level == PT64_ROOT_4LEVEL &&
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
            if (iterator->level == PT64_ROOT_4LEVEL &&
                                                    ^
    arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not 
equal to PT32E_ROOT_LEVEL
            if (iterator->level == PT32E_ROOT_LEVEL) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
            if (iterator->level == PT32E_ROOT_LEVEL) {
            ^
    arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 
'iterator->sptep'
    }
    ^
    arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 
'shadow_walk_init_using_root'
            shadow_walk_init_using_root(iterator, vcpu, 
vcpu->arch.mmu->root_hpa,
 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 
'iterator->sptep'
    }
    ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
            for (shadow_walk_init(&(_walker), _vcpu, _addr); 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < 
PG_LEVEL_4K
            if (iterator->level < PG_LEVEL_4K)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
            if (iterator->level < PG_LEVEL_4K)
            ^
    arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 
'iterator->sptep'
                    return false;
                    ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                                              ^
    arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                    if (!is_shadow_present_pte(spte))
                    ^
    arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                            break;
                            ^
    arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is 
an uninitialized value
            trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, 
iterator.sptep,
            ^ 
~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                    r = -EIO;
                    ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                    r = -EIO;
                    ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never 
read [clang-analyzer-deadcode.DeadStores]
                            r = -EIO;
                            ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                            r = -EIO;
                            ^   ~~~~
    Suppressed 5 warnings (5 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    2 warnings generated.
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    5 warnings generated.
    Suppressed 5 warnings (2 in non-user code, 3 with check filters).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    Suppressed 4 warnings (2 in non-user code, 2 with check filters).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    kernel/exit.c:1571:3: warning: Value stored to 'signo' is never read 
[clang-analyzer-deadcode.DeadStores]
                    signo = SIGCHLD;
                    ^
    kernel/exit.c:1571:3: note: Value stored to 'signo' is never read
    kernel/exit.c:1706:3: warning: Value stored to 'signo' is never read 
[clang-analyzer-deadcode.DeadStores]
                    signo = SIGCHLD;
                    ^
    kernel/exit.c:1706:3: note: Value stored to 'signo' is never read
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    Suppressed 4 warnings (4 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    3 warnings generated.
    kernel/resource.c:83:2: warning: The expression is an uninitialized 
value. The computed value will also be garbage 
[clang-analyzer-core.uninitialized.Assign]
            (*pos)++;
            ^
    kernel/resource.c:1666:2: note: 'l' declared without an initial value
            loff_t l;
            ^~~~~~~~
    kernel/resource.c:1669:2: note: Loop condition is true.  Entering 
loop body
            for (p = p->child; p ; p = r_next(NULL, p, &l)) {
            ^
    kernel/resource.c:1674:7: note: Assuming the condition is true
                    if (p->start >= addr + size)
                        ^~~~~~~~~~~~~~~~~~~~~~~
    kernel/resource.c:1674:3: note: Taking true branch
                    if (p->start >= addr + size)
                    ^
    kernel/resource.c:1675:4: note:  Execution continues on line 1669
                            continue;
                            ^
    kernel/resource.c:1669:29: note: Calling 'r_next'
            for (p = p->child; p ; p = r_next(NULL, p, &l)) {
                                       ^~~~~~~~~~~~~~~~~~~
    kernel/resource.c:83:2: note: The expression is an uninitialized 
value. The computed value will also be garbage
            (*pos)++;
            ^~~~~~
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    kernel/sysctl.c:1484:10: warning: The left operand of '==' is a 
garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                            if (c == '-') {
                                ~ ^
    kernel/sysctl.c:1431:63: note: 'c' declared without an initial value
            char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
                                                                         ^
    kernel/sysctl.c:1433:6: note: Assuming 'bitmap' is non-null
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^~~~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
    kernel/sysctl.c:1433:17: note: Assuming 'bitmap_len' is not equal to 0
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                           ^~~~~~~~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^
    kernel/sysctl.c:1433:32: note: Assuming 'left' is not equal to 0
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                          ^~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^
    kernel/sysctl.c:1433:42: note: Assuming the condition is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                    ^~~~~
    kernel/sysctl.c:1433:48: note: Left side of '&&' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                          ^
    kernel/sysctl.c:1438:6: note: Assuming 'write' is not equal to 0
            if (write) {
                ^~~~~
    kernel/sysctl.c:1438:2: note: Taking true branch
            if (write) {
            ^
    kernel/sysctl.c:1442:7: note: Assuming the condition is false
                    if (left > PAGE_SIZE - 1) {

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3288  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3297  b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3300  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3303  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3305  	 * On SVM, reading PDPTRs might access guest memory, which might 
fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3313  6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3318  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3323  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02 
3334  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
@3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3339  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3342  	 * or a PAE 3-level page table. In either case we need to be 
aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3348  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3353  748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3356  17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity 
2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09 
3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3359  b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09 
3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12 
3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12 
3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26 
3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04 
3367  8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3372  ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3377  be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22 
3382  8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti 
2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27865 bytes --]

[-- Attachment #3: Attached Message Part --]
[-- Type: text/plain, Size: 150 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-08-09 10:49   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-08-09 10:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 23601 bytes --]


tree: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   85a90500f9a1717c4e142ce92e6c1cb1a339ec78
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs 
outside mmu_lock
date:   4 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-c001-20210806 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
42b9c2a17a0b63cccf3ac197a82f91b28e53e643)
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/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
         git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
         git fetch --no-tags linus master
         git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 
ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
    arch/x86/kvm/mmu/mmu.c:2963:2: note: Taking false branch
            if (unlikely(error_code & PFERR_RSVD_MASK))
            ^
    arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
            if (unlikely(((error_code & (PFERR_FETCH_MASK | 
PFERR_PRESENT_MASK))
                          ^
    include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
    # define unlikely(x)    __builtin_expect(!!(x), 0)
                                                ^
    arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
            if (unlikely(((error_code & (PFERR_FETCH_MASK | 
PFERR_PRESENT_MASK))
            ^
    arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 
'shadow_acc_track_mask' is equal to 0
            return shadow_acc_track_mask != 0 ||
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2985:9: note: Left side of '||' is false
    arch/x86/kvm/mmu/mmu.c:2986:10: note: Assuming the condition is true
                   ((error_code & (PFERR_WRITE_MASK | PFERR_PRESENT_MASK))
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which 
participates in a condition later
            return shadow_acc_track_mask != 0 ||
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 
'page_fault_can_be_fast'
            if (!page_fault_can_be_fast(error_code))
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
            if (!page_fault_can_be_fast(error_code))
            ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
            for (shadow_walk_init(&(_walker), _vcpu, _addr); 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 
'shadow_walk_init_using_root'
            shadow_walk_init_using_root(iterator, vcpu, 
vcpu->arch.mmu->root_hpa,
 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not 
equal to PT64_ROOT_4LEVEL
            if (iterator->level == PT64_ROOT_4LEVEL &&
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
            if (iterator->level == PT64_ROOT_4LEVEL &&
                                                    ^
    arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not 
equal to PT32E_ROOT_LEVEL
            if (iterator->level == PT32E_ROOT_LEVEL) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
            if (iterator->level == PT32E_ROOT_LEVEL) {
            ^
    arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 
'iterator->sptep'
    }
    ^
    arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 
'shadow_walk_init_using_root'
            shadow_walk_init_using_root(iterator, vcpu, 
vcpu->arch.mmu->root_hpa,
 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 
'iterator->sptep'
    }
    ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
            for (shadow_walk_init(&(_walker), _vcpu, _addr); 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < 
PG_LEVEL_4K
            if (iterator->level < PG_LEVEL_4K)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
            if (iterator->level < PG_LEVEL_4K)
            ^
    arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 
'iterator->sptep'
                    return false;
                    ^
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                    for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, 
iterator, spte)
                    ^
    arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 
'for_each_shadow_entry_lockless'
                 shadow_walk_okay(&(_walker)) && 
     \
                                              ^
    arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                    if (!is_shadow_present_pte(spte))
                    ^
    arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                            break;
                            ^
    arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is 
an uninitialized value
            trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, 
iterator.sptep,
            ^ 
~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                    r = -EIO;
                    ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                    r = -EIO;
                    ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never 
read [clang-analyzer-deadcode.DeadStores]
                            r = -EIO;
                            ^   ~~~~
    arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                            r = -EIO;
                            ^   ~~~~
    Suppressed 5 warnings (5 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    2 warnings generated.
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    5 warnings generated.
    Suppressed 5 warnings (2 in non-user code, 3 with check filters).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    Suppressed 4 warnings (2 in non-user code, 2 with check filters).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    kernel/exit.c:1571:3: warning: Value stored to 'signo' is never read 
[clang-analyzer-deadcode.DeadStores]
                    signo = SIGCHLD;
                    ^
    kernel/exit.c:1571:3: note: Value stored to 'signo' is never read
    kernel/exit.c:1706:3: warning: Value stored to 'signo' is never read 
[clang-analyzer-deadcode.DeadStores]
                    signo = SIGCHLD;
                    ^
    kernel/exit.c:1706:3: note: Value stored to 'signo' is never read
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    Suppressed 4 warnings (4 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    3 warnings generated.
    kernel/resource.c:83:2: warning: The expression is an uninitialized 
value. The computed value will also be garbage 
[clang-analyzer-core.uninitialized.Assign]
            (*pos)++;
            ^
    kernel/resource.c:1666:2: note: 'l' declared without an initial value
            loff_t l;
            ^~~~~~~~
    kernel/resource.c:1669:2: note: Loop condition is true.  Entering 
loop body
            for (p = p->child; p ; p = r_next(NULL, p, &l)) {
            ^
    kernel/resource.c:1674:7: note: Assuming the condition is true
                    if (p->start >= addr + size)
                        ^~~~~~~~~~~~~~~~~~~~~~~
    kernel/resource.c:1674:3: note: Taking true branch
                    if (p->start >= addr + size)
                    ^
    kernel/resource.c:1675:4: note:  Execution continues on line 1669
                            continue;
                            ^
    kernel/resource.c:1669:29: note: Calling 'r_next'
            for (p = p->child; p ; p = r_next(NULL, p, &l)) {
                                       ^~~~~~~~~~~~~~~~~~~
    kernel/resource.c:83:2: note: The expression is an uninitialized 
value. The computed value will also be garbage
            (*pos)++;
            ^~~~~~
    Suppressed 2 warnings (2 in non-user code).
    Use -header-filter=.* to display errors from all non-system headers. 
Use -system-headers to display errors from system headers as well.
    4 warnings generated.
    kernel/sysctl.c:1484:10: warning: The left operand of '==' is a 
garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                            if (c == '-') {
                                ~ ^
    kernel/sysctl.c:1431:63: note: 'c' declared without an initial value
            char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
                                                                         ^
    kernel/sysctl.c:1433:6: note: Assuming 'bitmap' is non-null
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^~~~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
    kernel/sysctl.c:1433:17: note: Assuming 'bitmap_len' is not equal to 0
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                           ^~~~~~~~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^
    kernel/sysctl.c:1433:32: note: Assuming 'left' is not equal to 0
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                          ^~~~~
    kernel/sysctl.c:1433:6: note: Left side of '||' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                ^
    kernel/sysctl.c:1433:42: note: Assuming the condition is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                    ^~~~~
    kernel/sysctl.c:1433:48: note: Left side of '&&' is false
            if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                          ^
    kernel/sysctl.c:1438:6: note: Assuming 'write' is not equal to 0
            if (write) {
                ^~~~~
    kernel/sysctl.c:1438:2: note: Taking true branch
            if (write) {
            ^
    kernel/sysctl.c:1442:7: note: Assuming the condition is false
                    if (left > PAGE_SIZE - 1) {

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3288  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3297  b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3300  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3303  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3305  	 * On SVM, reading PDPTRs might access guest memory, which might 
fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3313  6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3318  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3323  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20 
3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02 
3334  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
@3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3339  651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel 
2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3342  	 * or a PAE 3-level page table. In either case we need to be 
aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3348  4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini 
2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3353  748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3356  17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity 
2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09 
3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3359  b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09 
3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12 
3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12 
3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26 
3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04 
3367  8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27 
3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3372  ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10 
3377  be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 
2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04 
3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 
3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22 
3382  8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti 
2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05 
3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27865 bytes --]

[-- Attachment #3: AttachedMessagePart.ksh --]
[-- Type: text/plain, Size: 150 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-08-09  0:10 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-08-09  0:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 23714 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Paolo Bonzini <pbonzini@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   36a21d51725af2ce0700c6ebcb6b9594aac658a6
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs outside mmu_lock
date:   4 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-c001-20210806 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 42b9c2a17a0b63cccf3ac197a82f91b28e53e643)
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/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   arch/x86/kvm/mmu/mmu.c:2963:2: note: Taking false branch
           if (unlikely(error_code & PFERR_RSVD_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
                         ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 'shadow_acc_track_mask' is equal to 0
           return shadow_acc_track_mask != 0 ||
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Left side of '||' is false
   arch/x86/kvm/mmu/mmu.c:2986:10: note: Assuming the condition is true
                  ((error_code & (PFERR_WRITE_MASK | PFERR_PRESENT_MASK))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which participates in a condition later
           return shadow_acc_track_mask != 0 ||
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 'page_fault_can_be_fast'
           if (!page_fault_can_be_fast(error_code))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
           if (!page_fault_can_be_fast(error_code))
           ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not equal to PT64_ROOT_4LEVEL
           if (iterator->level == PT64_ROOT_4LEVEL &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
           if (iterator->level == PT64_ROOT_4LEVEL &&
                                                   ^
   arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not equal to PT32E_ROOT_LEVEL
           if (iterator->level == PT32E_ROOT_LEVEL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
           if (iterator->level == PT32E_ROOT_LEVEL) {
           ^
   arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < PG_LEVEL_4K
           if (iterator->level < PG_LEVEL_4K)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
           if (iterator->level < PG_LEVEL_4K)
           ^
   arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 'iterator->sptep'
                   return false;
                   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                                             ^
   arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                   if (!is_shadow_present_pte(spte))
                   ^
   arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                           break;
                           ^
   arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is an uninitialized value
           trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, iterator.sptep,
           ^                                                   ~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                           r = -EIO;
                           ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                           r = -EIO;
                           ^   ~~~~
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   include/linux/hid.h:999:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference]
                                       input->name, c, type);
                                       ^
   drivers/hid/hid-apple.c:371:6: note: Assuming the condition is true
           if (usage->hid == (HID_UP_CUSTOM | 0x0003) ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-apple.c:371:45: note: Left side of '||' is true
           if (usage->hid == (HID_UP_CUSTOM | 0x0003) ||
                                                      ^
   drivers/hid/hid-apple.c:376:3: note: Calling 'hid_map_usage_clear'
                   hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1027:2: note: Calling 'hid_map_usage'
           hid_map_usage(hidinput, usage, bit, max, type, c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:974:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:978:2: note: Control jumps to 'case 1:'  at line 987
           switch (type) {
           ^
   include/linux/hid.h:990:3: note:  Execution continues on line 997
                   break;
                   ^
   include/linux/hid.h:997:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:997:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:997:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:998:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:511:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:998:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:511:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3288  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3297  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3300  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3303  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3305  	 * On SVM, reading PDPTRs might access guest memory, which might fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3313  
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3318  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3323  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02  3334  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 @3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3339  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3342  	 * or a PAE 3-level page table. In either case we need to be aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3348  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3353  
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3356  
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3359  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26  3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04  3367  
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3372  
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3377  
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22  3382  
8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti     2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27866 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-08-08 15:21 kernel test robot
  2021-08-09 10:49   ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-08-08 15:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 23570 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Paolo Bonzini <pbonzini@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   85a90500f9a1717c4e142ce92e6c1cb1a339ec78
commit: 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5 KVM: MMU: load PDPTRs outside mmu_lock
date:   4 months ago
:::::: branch date: 22 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-c001-20210806 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 42b9c2a17a0b63cccf3ac197a82f91b28e53e643)
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/linux/kernel/git/torvalds/linux.git/commit/?id=4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4a38162ee9f10f5f67c36f4f5aa4f6be2657efd5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   arch/x86/kvm/mmu/mmu.c:2963:2: note: Taking false branch
           if (unlikely(error_code & PFERR_RSVD_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2967:16: note: Assuming the condition is false
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
                         ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   arch/x86/kvm/mmu/mmu.c:2967:2: note: Taking false branch
           if (unlikely(((error_code & (PFERR_FETCH_MASK | PFERR_PRESENT_MASK))
           ^
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Assuming 'shadow_acc_track_mask' is equal to 0
           return shadow_acc_track_mask != 0 ||
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:9: note: Left side of '||' is false
   arch/x86/kvm/mmu/mmu.c:2986:10: note: Assuming the condition is true
                  ((error_code & (PFERR_WRITE_MASK | PFERR_PRESENT_MASK))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2985:2: note: Returning the value 1, which participates in a condition later
           return shadow_acc_track_mask != 0 ||
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:7: note: Returning from 'page_fault_can_be_fast'
           if (!page_fault_can_be_fast(error_code))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3053:2: note: Taking false branch
           if (!page_fault_can_be_fast(error_code))
           ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Calling 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:6: note: Assuming field 'level' is not equal to PT64_ROOT_4LEVEL
           if (iterator->level == PT64_ROOT_4LEVEL &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2087:42: note: Left side of '&&' is false
           if (iterator->level == PT64_ROOT_4LEVEL &&
                                                   ^
   arch/x86/kvm/mmu/mmu.c:2092:6: note: Assuming field 'level' is not equal to PT32E_ROOT_LEVEL
           if (iterator->level == PT32E_ROOT_LEVEL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2092:2: note: Taking false branch
           if (iterator->level == PT32E_ROOT_LEVEL) {
           ^
   arch/x86/kvm/mmu/mmu.c:2106:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:2111:2: note: Returning from 'shadow_walk_init_using_root'
           shadow_walk_init_using_root(iterator, vcpu, vcpu->arch.mmu->root_hpa,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2113:1: note: Returning without writing to 'iterator->sptep'
   }
   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_init'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:166:7: note: expanded from macro 'for_each_shadow_entry_lockless'
           for (shadow_walk_init(&(_walker), _vcpu, _addr);                \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Calling 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:6: note: Assuming field 'level' is < PG_LEVEL_4K
           if (iterator->level < PG_LEVEL_4K)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:2117:2: note: Taking true branch
           if (iterator->level < PG_LEVEL_4K)
           ^
   arch/x86/kvm/mmu/mmu.c:2118:3: note: Returning without writing to 'iterator->sptep'
                   return false;
                   ^
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Returning from 'shadow_walk_okay'
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:7: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/mmu.c:3061:3: note: Left side of '&&' is false
                   for_each_shadow_entry_lockless(vcpu, cr2_or_gpa, iterator, spte)
                   ^
   arch/x86/kvm/mmu/mmu.c:167:36: note: expanded from macro 'for_each_shadow_entry_lockless'
                shadow_walk_okay(&(_walker)) &&                            \
                                             ^
   arch/x86/kvm/mmu/mmu.c:3065:3: note: Taking true branch
                   if (!is_shadow_present_pte(spte))
                   ^
   arch/x86/kvm/mmu/mmu.c:3066:4: note:  Execution continues on line 3140
                           break;
                           ^
   arch/x86/kvm/mmu/mmu.c:3140:2: note: 4th function call argument is an uninitialized value
           trace_fast_page_fault(vcpu, cr2_or_gpa, error_code, iterator.sptep,
           ^                                                   ~~~~~~~~~~~~~~
>> arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3336:3: note: Value stored to 'r' is never read
                   r = -EIO;
                   ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores]
                           r = -EIO;
                           ^   ~~~~
   arch/x86/kvm/mmu/mmu.c:3350:4: note: Value stored to 'r' is never read
                           r = -EIO;
                           ^   ~~~~
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (2 in non-user code, 3 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (2 in non-user code, 2 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   kernel/exit.c:1571:3: warning: Value stored to 'signo' is never read [clang-analyzer-deadcode.DeadStores]
                   signo = SIGCHLD;
                   ^
   kernel/exit.c:1571:3: note: Value stored to 'signo' is never read
   kernel/exit.c:1706:3: warning: Value stored to 'signo' is never read [clang-analyzer-deadcode.DeadStores]
                   signo = SIGCHLD;
                   ^
   kernel/exit.c:1706:3: note: Value stored to 'signo' is never read
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   kernel/resource.c:83:2: warning: The expression is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
           (*pos)++;
           ^
   kernel/resource.c:1666:2: note: 'l' declared without an initial value
           loff_t l;
           ^~~~~~~~
   kernel/resource.c:1669:2: note: Loop condition is true.  Entering loop body
           for (p = p->child; p ; p = r_next(NULL, p, &l)) {
           ^
   kernel/resource.c:1674:7: note: Assuming the condition is true
                   if (p->start >= addr + size)
                       ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/resource.c:1674:3: note: Taking true branch
                   if (p->start >= addr + size)
                   ^
   kernel/resource.c:1675:4: note:  Execution continues on line 1669
                           continue;
                           ^
   kernel/resource.c:1669:29: note: Calling 'r_next'
           for (p = p->child; p ; p = r_next(NULL, p, &l)) {
                                      ^~~~~~~~~~~~~~~~~~~
   kernel/resource.c:83:2: note: The expression is an uninitialized value. The computed value will also be garbage
           (*pos)++;
           ^~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   kernel/sysctl.c:1484:10: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                           if (c == '-') {
                               ~ ^
   kernel/sysctl.c:1431:63: note: 'c' declared without an initial value
           char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
                                                                        ^
   kernel/sysctl.c:1433:6: note: Assuming 'bitmap' is non-null
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
               ^~~~~~~
   kernel/sysctl.c:1433:6: note: Left side of '||' is false
   kernel/sysctl.c:1433:17: note: Assuming 'bitmap_len' is not equal to 0
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                          ^~~~~~~~~~~
   kernel/sysctl.c:1433:6: note: Left side of '||' is false
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
               ^
   kernel/sysctl.c:1433:32: note: Assuming 'left' is not equal to 0
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                         ^~~~~
   kernel/sysctl.c:1433:6: note: Left side of '||' is false
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
               ^
   kernel/sysctl.c:1433:42: note: Assuming the condition is false
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                   ^~~~~
   kernel/sysctl.c:1433:48: note: Left side of '&&' is false
           if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
                                                         ^
   kernel/sysctl.c:1438:6: note: Assuming 'write' is not equal to 0
           if (write) {
               ^~~~~
   kernel/sysctl.c:1438:2: note: Taking true branch
           if (write) {
           ^
   kernel/sysctl.c:1442:7: note: Assuming the condition is false
                   if (left > PAGE_SIZE - 1) {

vim +/r +3336 arch/x86/kvm/mmu/mmu.c

651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3288  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3289  static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3290  {
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3291  	struct kvm_mmu *mmu = vcpu->arch.mmu;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3292  	u64 pdptrs[4], pm_mask;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3293  	gfn_t root_gfn, root_pgd;
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3294  	hpa_t root;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3295  	unsigned i;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3296  	int r;
3bb65a22a45020 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3297  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3298  	root_pgd = mmu->get_guest_pgd(vcpu);
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3299  	root_gfn = root_pgd >> PAGE_SHIFT;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3300  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3301  	if (mmu_check_root(vcpu, root_gfn))
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3302  		return 1;
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3303  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3304  	/*
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3305  	 * On SVM, reading PDPTRs might access guest memory, which might fault
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3306  	 * and thus might sleep.  Grab the PDPTRs before acquiring mmu_lock.
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3307  	 */
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3308  	if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3309  		for (i = 0; i < 4; ++i) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3310  			pdptrs[i] = mmu->get_pdptr(vcpu, i);
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3311  			if (!(pdptrs[i] & PT_PRESENT_MASK))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3312  				continue;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3313  
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3314  			if (mmu_check_root(vcpu, pdptrs[i] >> PAGE_SHIFT))
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3315  				return 1;
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3316  		}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3317  	}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3318  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3319  	write_lock(&vcpu->kvm->mmu_lock);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3320  	r = make_mmu_pages_available(vcpu);
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3321  	if (r < 0)
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3322  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3323  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3324  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3325  	 * Do we shadow a long mode page table? If so we need to
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3326  	 * write-protect the guests page table root.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3327  	 */
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3328  	if (mmu->root_level >= PT64_ROOT_4LEVEL) {
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3329  		root = mmu_alloc_root(vcpu, root_gfn, 0,
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3330  				      mmu->shadow_root_level, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3331  		mmu->root_hpa = root;
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3332  		goto set_root_pgd;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3333  	}
f87f928882d080 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-02  3334  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3335  	if (WARN_ON_ONCE(!mmu->pae_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08 @3336  		r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3337  		goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3338  	}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3339  
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3340  	/*
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3341  	 * We shadow a 32 bit page table. This may be a legacy 2-level
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3342  	 * or a PAE 3-level page table. In either case we need to be aware that
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3343  	 * the shadow page table may be a PAE or a long mode page table.
651dd37a9ce6fd arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3344  	 */
17e368d94af77c arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3345  	pm_mask = PT_PRESENT_MASK | shadow_me_mask;
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3346  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL) {
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3347  		pm_mask |= PT_ACCESSED_MASK | PT_WRITABLE_MASK | PT_USER_MASK;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3348  
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3349  		if (WARN_ON_ONCE(!mmu->lm_root)) {
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3350  			r = -EIO;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3351  			goto out_unlock;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3352  		}
73ad160693dc3b arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3353  
748e52b9b73680 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3354  		mmu->lm_root[0] = __pa(mmu->pae_root) | pm_mask;
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3355  	}
04d45551a1eefb arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3356  
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3357  	for (i = 0; i < 4; ++i) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3358  		WARN_ON_ONCE(IS_VALID_PAE_ROOT(mmu->pae_root[i]));
6e6ec58485746e arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3359  
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3360  		if (mmu->root_level == PT32E_ROOT_LEVEL) {
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3361  			if (!(pdptrs[i] & PT_PRESENT_MASK)) {
c834e5e44fc15a arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-09  3362  				mmu->pae_root[i] = INVALID_PAE_ROOT;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3363  				continue;
417726a3fbecb2 drivers/kvm/mmu.c      Avi Kivity          2007-04-12  3364  			}
6e0918aec49a5f arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3365  			root_gfn = pdptrs[i] >> PAGE_SHIFT;
5a7388c2d2faa2 arch/x86/kvm/mmu.c     Eric Northup        2010-04-26  3366  		}
8facbbff071ff2 arch/x86/kvm/mmu.c     Avi Kivity          2010-05-04  3367  
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3368  		root = mmu_alloc_root(vcpu, root_gfn, i << 30,
8123f265248c85 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-04-27  3369  				      PT32_ROOT_LEVEL, false);
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3370  		mmu->pae_root[i] = root | pm_mask;
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3371  	}
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3372  
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3373  	if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3374  		mmu->root_hpa = __pa(mmu->lm_root);
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3375  	else
ba0a194ffbfb41 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3376  		mmu->root_hpa = __pa(mmu->pae_root);
81407ca553c0c8 arch/x86/kvm/mmu.c     Joerg Roedel        2010-09-10  3377  
be01e8e2c632c4 arch/x86/kvm/mmu/mmu.c Sean Christopherson 2020-03-20  3378  set_root_pgd:
b37233c911cbec arch/x86/kvm/mmu/mmu.c Sean Christopherson 2021-03-04  3379  	mmu->root_pgd = root_pgd;
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3380  out_unlock:
4a38162ee9f10f arch/x86/kvm/mmu/mmu.c Paolo Bonzini       2021-04-08  3381  	write_unlock(&vcpu->kvm->mmu_lock);
ad7dc69aeb2313 arch/x86/kvm/mmu.c     Vitaly Kuznetsov    2019-02-22  3382  
8986ecc0ef58c9 arch/x86/kvm/mmu.c     Marcelo Tosatti     2009-05-12  3383  	return 0;
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3384  }
17ac10ad2bb7d8 drivers/kvm/mmu.c      Avi Kivity          2007-01-05  3385  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27865 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-09  7:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09  7:41 arch/x86/kvm/mmu/mmu.c:3336:3: warning: Value stored to 'r' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-11-24  0:54 kernel test robot
2021-08-09  0:10 kernel test robot
2021-08-08 15:21 kernel test robot
2021-08-09 10:49 ` kernel test robot
2021-08-09 10:49   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.