drivers/scsi/mpi3mr/mpi3mr_fw.c:1549:60: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 11
From: kernel test robot
Date: Tue Dec 03 2024 - 01:48:06 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cdd30ebb1b9f36159d66f088b61aee264e649d7a
commit: 672ae26c82166d63e0352403b7ea16ab4705edc1 scsi: mpi3mr: Add support for internal watchdog thread
date: 3 years, 6 months ago
config: x86_64-randconfig-015-20240106 (https://download.01.org/0day-ci/archive/20241203/202412031406.ymLEG23a-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412031406.ymLEG23a-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412031406.ymLEG23a-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_setup_isr':
drivers/scsi/mpi3mr/mpi3mr_fw.c:453:58: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
453 | snprintf(intr_info->name, MPI3MR_NAME_LENGTH, "%s%d-msix%d",
| ^~
drivers/scsi/mpi3mr/mpi3mr_fw.c:453:55: note: directive argument in the range [0, 255]
453 | snprintf(intr_info->name, MPI3MR_NAME_LENGTH, "%s%d-msix%d",
| ^~~~~~~~~~~~~
drivers/scsi/mpi3mr/mpi3mr_fw.c:453:55: note: directive argument in the range [0, 65535]
drivers/scsi/mpi3mr/mpi3mr_fw.c:453:9: note: 'snprintf' output between 8 and 45 bytes into a destination of size 32
453 | snprintf(intr_info->name, MPI3MR_NAME_LENGTH, "%s%d-msix%d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
454 | mrioc->driver_name, mrioc->id, index);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_start_watchdog':
>> drivers/scsi/mpi3mr/mpi3mr_fw.c:1549:60: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 11 [-Wformat-truncation=]
1549 | sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
| ^~
drivers/scsi/mpi3mr/mpi3mr_fw.c:1549:50: note: directive argument in the range [0, 255]
1549 | sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
| ^~~~~~~~~~~~~~~
drivers/scsi/mpi3mr/mpi3mr_fw.c:1548:9: note: 'snprintf' output between 11 and 44 bytes into a destination of size 20
1548 | snprintf(mrioc->watchdog_work_q_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1549 | sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1550 | mrioc->id);
| ~~~~~~~~~~
vim +1549 drivers/scsi/mpi3mr/mpi3mr_fw.c
1532
1533 /**
1534 * mpi3mr_start_watchdog - Start watchdog
1535 * @mrioc: Adapter instance reference
1536 *
1537 * Create and start the watchdog thread to monitor controller
1538 * faults.
1539 *
1540 * Return: Nothing.
1541 */
1542 void mpi3mr_start_watchdog(struct mpi3mr_ioc *mrioc)
1543 {
1544 if (mrioc->watchdog_work_q)
1545 return;
1546
1547 INIT_DELAYED_WORK(&mrioc->watchdog_work, mpi3mr_watchdog_work);
1548 snprintf(mrioc->watchdog_work_q_name,
> 1549 sizeof(mrioc->watchdog_work_q_name), "watchdog_%s%d", mrioc->name,
1550 mrioc->id);
1551 mrioc->watchdog_work_q =
1552 create_singlethread_workqueue(mrioc->watchdog_work_q_name);
1553 if (!mrioc->watchdog_work_q) {
1554 ioc_err(mrioc, "%s: failed (line=%d)\n", __func__, __LINE__);
1555 return;
1556 }
1557
1558 if (mrioc->watchdog_work_q)
1559 queue_delayed_work(mrioc->watchdog_work_q,
1560 &mrioc->watchdog_work,
1561 msecs_to_jiffies(MPI3MR_WATCHDOG_INTERVAL));
1562 }
1563
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki