All of lore.kernel.org
 help / color / mirror / Atom feed
* [avpatel:riscv_sbi_dbcn_v1 24/36] arch/riscv/kvm/aia.c:31:43: warning: Parameter 'owner' can be declared as pointer to const [constParameter]
@ 2022-11-07 17:00 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-11-07 17:00 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: arch/riscv/kvm/aia.c:31:43: warning: Parameter 'owner' can be declared as pointer to const [constParameter]"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Anup Patel <apatel@ventanamicro.com>

tree:   https://github.com/avpatel/linux.git riscv_sbi_dbcn_v1
head:   640c4126b855fd927f554cd45b172effa6d6f3b9
commit: 325cd39ca129e58e5ced2ee7c19375d52e2d622f [24/36] RISC-V: KVM: Implement guest external interrupt line management
:::::: branch date: 9 hours ago
:::::: commit date: 3 weeks ago
compiler: riscv64-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 325cd39ca129e58e5ced2ee7c19375d52e2d622f
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> arch/riscv/kvm/aia.c:31:43: warning: Parameter 'owner' can be declared as pointer to const [constParameter]
   static int aia_find_hgei(struct kvm_vcpu *owner)
                                             ^
--
>> arch/riscv/kvm/vcpu_insn.c:612:9: warning: Expression '-(20-2)' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
    data = GET_RS2(insn, &vcpu->arch.guest_context);
           ^
   arch/riscv/kvm/vcpu_insn.c:636:12: warning: Expression '0-2' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
     data32 = GET_RS2S(insn, &vcpu->arch.guest_context);
              ^
   arch/riscv/kvm/vcpu_insn.c:612:9: warning: Expression '-(20-3)' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
    data = GET_RS2(insn, &vcpu->arch.guest_context);
           ^
   arch/riscv/kvm/vcpu_insn.c:628:12: warning: Expression '0-3' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
     data64 = GET_RS2S(insn, &vcpu->arch.guest_context);
              ^
   arch/riscv/kvm/vcpu_insn.c:632:12: warning: Expression '2-3' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
     data64 = GET_RS2C(insn, &vcpu->arch.guest_context);
              ^
   arch/riscv/kvm/vcpu_insn.c:636:12: warning: Expression '0-3' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
     data32 = GET_RS2S(insn, &vcpu->arch.guest_context);
              ^
   arch/riscv/kvm/vcpu_insn.c:640:12: warning: Expression '2-3' can have a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion]
     data32 = GET_RS2C(insn, &vcpu->arch.guest_context);
              ^

vim +/owner +31 arch/riscv/kvm/aia.c

10a16774bdaeea Anup Patel 2022-01-19  30  
325cd39ca129e5 Anup Patel 2022-01-19 @31  static int aia_find_hgei(struct kvm_vcpu *owner)
325cd39ca129e5 Anup Patel 2022-01-19  32  {
325cd39ca129e5 Anup Patel 2022-01-19  33  	int i, hgei;
325cd39ca129e5 Anup Patel 2022-01-19  34  	unsigned long flags;
325cd39ca129e5 Anup Patel 2022-01-19  35  	struct aia_hgei_control *hgctrl = this_cpu_ptr(&aia_hgei);
325cd39ca129e5 Anup Patel 2022-01-19  36  
325cd39ca129e5 Anup Patel 2022-01-19  37  	raw_spin_lock_irqsave(&hgctrl->lock, flags);
325cd39ca129e5 Anup Patel 2022-01-19  38  
325cd39ca129e5 Anup Patel 2022-01-19  39  	hgei = -1;
325cd39ca129e5 Anup Patel 2022-01-19  40  	for (i = 1; i <= kvm_riscv_aia_nr_hgei; i++) {
325cd39ca129e5 Anup Patel 2022-01-19  41  		if (hgctrl->owners[i] == owner) {
325cd39ca129e5 Anup Patel 2022-01-19  42  			hgei = i;
325cd39ca129e5 Anup Patel 2022-01-19  43  			break;
325cd39ca129e5 Anup Patel 2022-01-19  44  		}
325cd39ca129e5 Anup Patel 2022-01-19  45  	}
325cd39ca129e5 Anup Patel 2022-01-19  46  
325cd39ca129e5 Anup Patel 2022-01-19  47  	raw_spin_unlock_irqrestore(&hgctrl->lock, flags);
325cd39ca129e5 Anup Patel 2022-01-19  48  
325cd39ca129e5 Anup Patel 2022-01-19  49  	return hgei;
325cd39ca129e5 Anup Patel 2022-01-19  50  }
325cd39ca129e5 Anup Patel 2022-01-19  51  

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

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

only message in thread, other threads:[~2022-11-07 17:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 17:00 [avpatel:riscv_sbi_dbcn_v1 24/36] arch/riscv/kvm/aia.c:31:43: warning: Parameter 'owner' can be declared as pointer to const [constParameter] 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.