linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [arm-platforms:kvm-arm64/pmu-chained 6/6] arch/arm64/kvm/pmu-emul.c:175:7: warning: variable 'val' is used uninitialized whenever 'if' condition is false
@ 2022-08-01 23:01 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-08-01 23:01 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: llvm, kbuild-all, linux-arm-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/pmu-chained
head:   ed5c6c9ddd3a3376659e45652c263cee7ee0ac2f
commit: ed5c6c9ddd3a3376659e45652c263cee7ee0ac2f [6/6] rework overflow conditions
config: arm64-buildonly-randconfig-r003-20220801 (https://download.01.org/0day-ci/archive/20220802/202208020643.wTCgOkeH-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=ed5c6c9ddd3a3376659e45652c263cee7ee0ac2f
        git remote add arm-platforms https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms kvm-arm64/pmu-chained
        git checkout ed5c6c9ddd3a3376659e45652c263cee7ee0ac2f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kvm/

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

All warnings (new ones prefixed by >>):

>> arch/arm64/kvm/pmu-emul.c:175:7: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (!kvm_pmu_idx_is_64bit(vcpu, pmc->idx))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/pmu-emul.c:179:30: note: uninitialized use occurs here
           __vcpu_sys_reg(vcpu, reg) = val;
                                       ^~~
   arch/arm64/kvm/pmu-emul.c:175:3: note: remove the 'if' if its condition is always true
                   if (!kvm_pmu_idx_is_64bit(vcpu, pmc->idx))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm64/kvm/pmu-emul.c:163:23: note: initialize the variable 'val' to silence this warning
           u64 counter, reg, val;
                                ^
                                 = 0
   1 warning generated.


vim +175 arch/arm64/kvm/pmu-emul.c

   154	
   155	/**
   156	 * kvm_pmu_stop_counter - stop PMU counter
   157	 * @pmc: The PMU counter pointer
   158	 *
   159	 * If this counter has been configured to monitor some event, release it here.
   160	 */
   161	static void kvm_pmu_stop_counter(struct kvm_vcpu *vcpu, struct kvm_pmc *pmc)
   162	{
   163		u64 counter, reg, val;
   164	
   165		if (!pmc->perf_event)
   166			return;
   167	
   168		counter = kvm_pmu_get_counter_value(vcpu, pmc->idx);
   169	
   170		if (pmc->idx == ARMV8_PMU_CYCLE_IDX) {
   171			reg = PMCCNTR_EL0;
   172			val = counter;
   173		} else {
   174			reg = PMEVCNTR0_EL0 + pmc->idx;
 > 175			if (!kvm_pmu_idx_is_64bit(vcpu, pmc->idx))
   176				val = lower_32_bits(counter);
   177		}
   178	
   179		__vcpu_sys_reg(vcpu, reg) = val;
   180	
   181		kvm_pmu_release_perf_event(pmc);
   182	}
   183	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-01 23:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 23:01 [arm-platforms:kvm-arm64/pmu-chained 6/6] arch/arm64/kvm/pmu-emul.c:175:7: warning: variable 'val' is used uninitialized whenever 'if' condition is false kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).