* drivers/crypto/hisilicon/sec2/sec_main.c:282:6: warning: Local variable 'ctx_q_num' shadows outer variable [shadowVariable]
@ 2022-11-11 8:57 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-11-11 8:57 UTC (permalink / raw)
To: Huacai Chen; +Cc: oe-kbuild-all, linux-kernel, WANG Xuerui, Jianmin Lv
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4bbf3422df78029f03161640dcb1e9d1ed64d1ea
commit: 57fc7323a8e7c2e7c1d5795ab63cb3ffea3cfdfb LoongArch: Add PCI controller support
date: 3 months ago
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout 57fc7323a8e7c2e7c1d5795ab63cb3ffea3cfdfb
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 warnings: (new ones prefixed by >>)
>> drivers/crypto/hisilicon/sec2/sec_main.c:282:6: warning: Local variable 'ctx_q_num' shadows outer variable [shadowVariable]
u32 ctx_q_num;
^
drivers/crypto/hisilicon/sec2/sec_main.c:304:12: note: Shadowed declaration
static u32 ctx_q_num = SEC_CTX_Q_NUM_DEF;
^
drivers/crypto/hisilicon/sec2/sec_main.c:282:6: note: Shadow variable
u32 ctx_q_num;
^
--
drivers/crypto/hisilicon/qm.c:4563:8: warning: %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
ret = sscanf(tbuf_bdf, "%u:%x:%u.%u", &tmp1, &bus, &device, &function);
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/crypto/hisilicon/qm.c:1704:2: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
dregs = NULL;
^
>> drivers/crypto/hisilicon/qm.c:4553:8: warning: sscanf() without field width limits can crash with huge input data. [invalidscanf]
ret = sscanf(buf, "%s %s", tbuf_bdf, val_buf);
^
>> drivers/crypto/hisilicon/qm.c:3499:46: warning: Parameter 'pdev' can be declared as pointer to const [constParameter]
static int qm_try_frozen_vfs(struct pci_dev *pdev,
^
>> drivers/crypto/hisilicon/qm.c:4229:29: warning: Uninitialized variable: tmp->distance [uninitvar]
if (res->distance < tmp->distance) {
^
drivers/crypto/hisilicon/qm.c:4222:7: note: Assuming condition is false
if (!res)
^
drivers/crypto/hisilicon/qm.c:4229:29: note: Uninitialized variable: tmp->distance
if (res->distance < tmp->distance) {
^
vim +/ctx_q_num +282 drivers/crypto/hisilicon/sec2/sec_main.c
416d82204df44e Zaibo Xu 2019-11-13 279
416d82204df44e Zaibo Xu 2019-11-13 280 static int sec_ctx_q_num_set(const char *val, const struct kernel_param *kp)
416d82204df44e Zaibo Xu 2019-11-13 281 {
416d82204df44e Zaibo Xu 2019-11-13 @282 u32 ctx_q_num;
416d82204df44e Zaibo Xu 2019-11-13 283 int ret;
416d82204df44e Zaibo Xu 2019-11-13 284
416d82204df44e Zaibo Xu 2019-11-13 285 if (!val)
416d82204df44e Zaibo Xu 2019-11-13 286 return -EINVAL;
416d82204df44e Zaibo Xu 2019-11-13 287
416d82204df44e Zaibo Xu 2019-11-13 288 ret = kstrtou32(val, 10, &ctx_q_num);
416d82204df44e Zaibo Xu 2019-11-13 289 if (ret)
416d82204df44e Zaibo Xu 2019-11-13 290 return -EINVAL;
416d82204df44e Zaibo Xu 2019-11-13 291
7c7d902aa4059b Zaibo Xu 2020-01-11 292 if (!ctx_q_num || ctx_q_num > SEC_CTX_Q_NUM_MAX || ctx_q_num & 0x1) {
416d82204df44e Zaibo Xu 2019-11-13 293 pr_err("ctx queue num[%u] is invalid!\n", ctx_q_num);
416d82204df44e Zaibo Xu 2019-11-13 294 return -EINVAL;
416d82204df44e Zaibo Xu 2019-11-13 295 }
416d82204df44e Zaibo Xu 2019-11-13 296
416d82204df44e Zaibo Xu 2019-11-13 297 return param_set_int(val, kp);
416d82204df44e Zaibo Xu 2019-11-13 298 }
416d82204df44e Zaibo Xu 2019-11-13 299
:::::: The code at line 282 was first introduced by commit
:::::: 416d82204df44ef727de6eafafeaa4d12fdc78dc crypto: hisilicon - add HiSilicon SEC V2 driver
:::::: TO: Zaibo Xu <xuzaibo@huawei.com>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>
--
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-11 9:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 8:57 drivers/crypto/hisilicon/sec2/sec_main.c:282:6: warning: Local variable 'ctx_q_num' shadows outer variable [shadowVariable] 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
all inboxes | Powered by JetHome®