All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Marc Zyngier <maz@kernel.org>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-arm-kernel@lists.infradead.org
Subject: [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
Date: Tue, 2 Aug 2022 07:01:49 +0800	[thread overview]
Message-ID: <202208020643.wTCgOkeH-lkp@intel.com> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Marc Zyngier <maz@kernel.org>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-arm-kernel@lists.infradead.org
Subject: [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
Date: Tue, 2 Aug 2022 07:01:49 +0800	[thread overview]
Message-ID: <202208020643.wTCgOkeH-lkp@intel.com> (raw)

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

             reply	other threads:[~2022-08-01 23:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 23:01 kernel test robot [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202208020643.wTCgOkeH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.