[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202310020020.1lO8acXY-lkp@intel.com>
Date: Mon, 2 Oct 2023 00:28:15 +0800
From: kernel test robot <lkp@...el.com>
To: Rohan McLure <rmclure@...ux.ibm.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>
Subject: drivers/message/fusion/mptctl.c:1498:9: warning: 'strncpy' specified
bound 12 equals destination size
Hi Rohan,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e402b08634b398e9feb94902c7adcf05bb8ba47d
commit: 6f0926c00565a91f3bd7ca1aa05db307daed5e0f powerpc/kcsan: Add KCSAN Support
date: 8 months ago
config: powerpc64-randconfig-003-20231001 (https://download.01.org/0day-ci/archive/20231002/202310020020.1lO8acXY-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231002/202310020020.1lO8acXY-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310020020.1lO8acXY-lkp@intel.com/
All warnings (new ones prefixed by >>):
In function 'mptctl_readtest',
inlined from '__mptctl_ioctl' at drivers/message/fusion/mptctl.c:659:10:
>> drivers/message/fusion/mptctl.c:1498:9: warning: 'strncpy' specified bound 12 equals destination size [-Wstringop-truncation]
1498 | strncpy (karg.product, ioc->prod_name, MPT_PRODUCT_LENGTH);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +1498 drivers/message/fusion/mptctl.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1463
^1da177e4c3f41 Linus Torvalds 2005-04-16 1464 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
^1da177e4c3f41 Linus Torvalds 2005-04-16 1465 /* MPT IOCTL Test function.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1466 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 1467 * Outputs: None.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1468 * Return: 0 if successful
^1da177e4c3f41 Linus Torvalds 2005-04-16 1469 * -EFAULT if data unavailable
^1da177e4c3f41 Linus Torvalds 2005-04-16 1470 * -ENODEV if no such device/adapter
^1da177e4c3f41 Linus Torvalds 2005-04-16 1471 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1472 static int
28d76df18f0ad5 Dan Carpenter 2020-01-14 1473 mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1474 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1475 struct mpt_ioctl_test __user *uarg = (void __user *) arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1476 struct mpt_ioctl_test karg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1477
^1da177e4c3f41 Linus Torvalds 2005-04-16 1478 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
29dd3609f2fc70 Eric Moore 2007-09-14 1479 printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
^1da177e4c3f41 Linus Torvalds 2005-04-16 1480 "Unable to read in mpt_ioctl_test struct @ %p\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 1481 __FILE__, __LINE__, uarg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1482 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1483 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1484
09120a8cd38dbd Prakash, Sathya 2007-07-24 1485 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
09120a8cd38dbd Prakash, Sathya 2007-07-24 1486 ioc->name));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1487 /* Fill in the data and return the structure to the calling
^1da177e4c3f41 Linus Torvalds 2005-04-16 1488 * program
^1da177e4c3f41 Linus Torvalds 2005-04-16 1489 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1490
^1da177e4c3f41 Linus Torvalds 2005-04-16 1491 #ifdef MFCNT
^1da177e4c3f41 Linus Torvalds 2005-04-16 1492 karg.chip_type = ioc->mfcnt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1493 #else
^1da177e4c3f41 Linus Torvalds 2005-04-16 1494 karg.chip_type = ioc->pcidev->device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1495 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 1496 strncpy (karg.name, ioc->name, MPT_MAX_NAME);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1497 karg.name[MPT_MAX_NAME-1]='\0';
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1498 strncpy (karg.product, ioc->prod_name, MPT_PRODUCT_LENGTH);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1499 karg.product[MPT_PRODUCT_LENGTH-1]='\0';
^1da177e4c3f41 Linus Torvalds 2005-04-16 1500
^1da177e4c3f41 Linus Torvalds 2005-04-16 1501 /* Copy the data from kernel memory to user memory
^1da177e4c3f41 Linus Torvalds 2005-04-16 1502 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1503 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) {
29dd3609f2fc70 Eric Moore 2007-09-14 1504 printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_readtest - "
^1da177e4c3f41 Linus Torvalds 2005-04-16 1505 "Unable to write out mpt_ioctl_test struct @ %p\n",
29dd3609f2fc70 Eric Moore 2007-09-14 1506 ioc->name, __FILE__, __LINE__, uarg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1507 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1508 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1509
^1da177e4c3f41 Linus Torvalds 2005-04-16 1510 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1511 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1512
:::::: The code at line 1498 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists