All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: [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]
Date: Tue, 8 Nov 2022 01:00:22 +0800	[thread overview]
Message-ID: <202211080014.MHPrgml8-lkp@intel.com> (raw)

:::::: 
:::::: 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

                 reply	other threads:[~2022-11-07 17:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202211080014.MHPrgml8-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.