lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202112080820.BR1BIqGS-lkp@intel.com>
Date:   Wed, 8 Dec 2021 08:10:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Anup Patel <anup.patel@....com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [avpatel:riscv_kvm_aia_v1 39/40] arch/riscv/kvm/aia_aplic.c:254:6:
 warning: variable 'inject' is used uninitialized whenever 'if' condition is
 true

tree:   https://github.com/avpatel/linux.git riscv_kvm_aia_v1
head:   eb55ca3817a59020fc1e3d5a5de0a5adcebbedd0
commit: dc0299fdaf9714a56b13b955c086bab2f8bd4046 [39/40] RISC-V: KVM: Add in-kernel emulation of AIA APLIC
config: riscv-randconfig-c006-20211207 (https://download.01.org/0day-ci/archive/20211208/202112080820.BR1BIqGS-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/avpatel/linux/commit/dc0299fdaf9714a56b13b955c086bab2f8bd4046
        git remote add avpatel https://github.com/avpatel/linux.git
        git fetch --no-tags avpatel riscv_kvm_aia_v1
        git checkout dc0299fdaf9714a56b13b955c086bab2f8bd4046
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

>> arch/riscv/kvm/aia_aplic.c:254:6: warning: variable 'inject' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (irqd->sourcecfg & APLIC_SOURCECFG_D)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/kvm/aia_aplic.c:293:6: note: uninitialized use occurs here
           if (inject)
               ^~~~~~
   arch/riscv/kvm/aia_aplic.c:254:2: note: remove the 'if' if its condition is always false
           if (irqd->sourcecfg & APLIC_SOURCECFG_D)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/kvm/aia_aplic.c:242:13: note: initialize the variable 'inject' to silence this warning
           bool inject, ie;
                      ^
                       = 0
   1 warning generated.


vim +254 arch/riscv/kvm/aia_aplic.c

   238	
   239	int kvm_riscv_aia_aplic_inject(struct kvm *kvm, u32 source, bool level)
   240	{
   241		u32 target;
   242		bool inject, ie;
   243		unsigned long flags;
   244		struct aplic_irq *irqd;
   245		struct aplic *aplic = kvm->arch.aia.aplic_state;
   246	
   247		if (!aplic || !source || (aplic->nr_irqs <= source))
   248			return -ENODEV;
   249		irqd = &aplic->irqs[source];
   250		ie = (aplic->domaincfg & APLIC_DOMAINCFG_IE) ? true : false;
   251	
   252		raw_spin_lock_irqsave(&irqd->lock, flags);
   253	
 > 254		if (irqd->sourcecfg & APLIC_SOURCECFG_D)
   255			goto skip_unlock;
   256	
   257		switch (irqd->sourcecfg & APLIC_SOURCECFG_SM_MASK) {
   258		case APLIC_SOURCECFG_SM_EDGE_RISE:
   259			if (level && !(irqd->state & APLIC_IRQ_STATE_INPUT) &&
   260			    !(irqd->state & APLIC_IRQ_STATE_PENDING))
   261				irqd->state |= APLIC_IRQ_STATE_PENDING;
   262			break;
   263		case APLIC_SOURCECFG_SM_EDGE_FALL:
   264			if (!level && (irqd->state & APLIC_IRQ_STATE_INPUT) &&
   265			    !(irqd->state & APLIC_IRQ_STATE_PENDING))
   266				irqd->state |= APLIC_IRQ_STATE_PENDING;
   267			break;
   268		case APLIC_SOURCECFG_SM_LEVEL_HIGH:
   269			if (level && !(irqd->state & APLIC_IRQ_STATE_PENDING))
   270				irqd->state |= APLIC_IRQ_STATE_PENDING;
   271			break;
   272		case APLIC_SOURCECFG_SM_LEVEL_LOW:
   273			if (!level && !(irqd->state & APLIC_IRQ_STATE_PENDING))
   274				irqd->state |= APLIC_IRQ_STATE_PENDING;
   275			break;
   276		}
   277	
   278		if (level)
   279			irqd->state |= APLIC_IRQ_STATE_INPUT;
   280		else
   281			irqd->state &= ~APLIC_IRQ_STATE_INPUT;
   282	
   283		inject = false;
   284		target = irqd->target;
   285		if (ie && (irqd->state & APLIC_IRQ_STATE_ENPEND)) {
   286			irqd->state &= ~APLIC_IRQ_STATE_PENDING;
   287			inject = true;
   288		}
   289	
   290	skip_unlock:
   291		raw_spin_unlock_irqrestore(&irqd->lock, flags);
   292	
   293		if (inject)
   294			aplic_inject_msi(kvm, source, target);
   295	
   296		return 0;
   297	}
   298	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ