drivers/scsi/mpt3sas/mpt3sas_base.c:2830:68: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 26
From: kernel test robot
Date: Tue Dec 31 2024 - 22:09:12 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ccb98ccef0e543c2bd4ef1a72270461957f3d8d0
commit: 728bbc6cbff70051813730fb7977f5d99d867e12 scsi: mpt3sas: Affinity high iops queues IRQs to local node
date: 6 years ago
config: x86_64-randconfig-a013-20211029 (https://download.01.org/0day-ci/archive/20250101/202501011117.gx48tad9-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250101/202501011117.gx48tad9-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/202501011117.gx48tad9-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_request_irq':
>> drivers/scsi/mpt3sas/mpt3sas_base.c:2830:68: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 26 [-Wformat-truncation=]
2830 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
| ^~
drivers/scsi/mpt3sas/mpt3sas_base.c:2830:58: note: directive argument in the range [0, 255]
2830 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
| ^~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:2830:17: note: 'snprintf' output between 8 and 35 bytes into a destination of size 32
2830 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2831 | ioc->driver_name, ioc->id, index);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_start_watchdog':
drivers/scsi/mpt3sas/mpt3sas_base.c:681:57: warning: '%s' directive output may be truncated writing up to 23 bytes into a region of size 15 [-Wformat-truncation=]
681 | sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
| ^~
drivers/scsi/mpt3sas/mpt3sas_base.c:681:51: note: directive argument in the range [0, 255]
681 | sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
| ^~~~~~~~~~~~~~~~~~
drivers/scsi/mpt3sas/mpt3sas_base.c:680:9: note: 'snprintf' output between 14 and 39 bytes into a destination of size 20
680 | snprintf(ioc->fault_reset_work_q_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
681 | sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
682 | ioc->driver_name, ioc->id);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +2830 drivers/scsi/mpt3sas/mpt3sas_base.c
f92363d1235949 Sreekanth Reddy 2012-11-30 2804
f92363d1235949 Sreekanth Reddy 2012-11-30 2805 /**
f92363d1235949 Sreekanth Reddy 2012-11-30 2806 * _base_request_irq - request irq
f92363d1235949 Sreekanth Reddy 2012-11-30 2807 * @ioc: per adapter object
f92363d1235949 Sreekanth Reddy 2012-11-30 2808 * @index: msix index into vector table
f92363d1235949 Sreekanth Reddy 2012-11-30 2809 *
f92363d1235949 Sreekanth Reddy 2012-11-30 2810 * Inserting respective reply_queue into the list.
f92363d1235949 Sreekanth Reddy 2012-11-30 2811 */
f92363d1235949 Sreekanth Reddy 2012-11-30 2812 static int
1d55abc0e98a0b Hannes Reinecke 2017-02-22 2813 _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index)
f92363d1235949 Sreekanth Reddy 2012-11-30 2814 {
1d55abc0e98a0b Hannes Reinecke 2017-02-22 2815 struct pci_dev *pdev = ioc->pdev;
f92363d1235949 Sreekanth Reddy 2012-11-30 2816 struct adapter_reply_queue *reply_q;
f92363d1235949 Sreekanth Reddy 2012-11-30 2817 int r;
f92363d1235949 Sreekanth Reddy 2012-11-30 2818
f92363d1235949 Sreekanth Reddy 2012-11-30 2819 reply_q = kzalloc(sizeof(struct adapter_reply_queue), GFP_KERNEL);
f92363d1235949 Sreekanth Reddy 2012-11-30 2820 if (!reply_q) {
919d8a3f3fef99 Joe Perches 2018-09-17 2821 ioc_err(ioc, "unable to allocate memory %zu!\n",
919d8a3f3fef99 Joe Perches 2018-09-17 2822 sizeof(struct adapter_reply_queue));
f92363d1235949 Sreekanth Reddy 2012-11-30 2823 return -ENOMEM;
f92363d1235949 Sreekanth Reddy 2012-11-30 2824 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2825 reply_q->ioc = ioc;
f92363d1235949 Sreekanth Reddy 2012-11-30 2826 reply_q->msix_index = index;
14b3114d940cdc Sreekanth Reddy 2015-01-12 2827
f92363d1235949 Sreekanth Reddy 2012-11-30 2828 atomic_set(&reply_q->busy, 0);
f92363d1235949 Sreekanth Reddy 2012-11-30 2829 if (ioc->msix_enable)
f92363d1235949 Sreekanth Reddy 2012-11-30 @2830 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
c84b06a48c4d8a Sreekanth Reddy 2015-11-11 2831 ioc->driver_name, ioc->id, index);
f92363d1235949 Sreekanth Reddy 2012-11-30 2832 else
f92363d1235949 Sreekanth Reddy 2012-11-30 2833 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d",
c84b06a48c4d8a Sreekanth Reddy 2015-11-11 2834 ioc->driver_name, ioc->id);
1d55abc0e98a0b Hannes Reinecke 2017-02-22 2835 r = request_irq(pci_irq_vector(pdev, index), _base_interrupt,
1d55abc0e98a0b Hannes Reinecke 2017-02-22 2836 IRQF_SHARED, reply_q->name, reply_q);
f92363d1235949 Sreekanth Reddy 2012-11-30 2837 if (r) {
fc7d510ec4c8ff Joe Perches 2018-09-17 2838 pr_err("%s: unable to allocate interrupt %d!\n",
1d55abc0e98a0b Hannes Reinecke 2017-02-22 2839 reply_q->name, pci_irq_vector(pdev, index));
da3cec2515f009 Suganath prabu Subramani 2016-02-11 2840 kfree(reply_q);
f92363d1235949 Sreekanth Reddy 2012-11-30 2841 return -EBUSY;
f92363d1235949 Sreekanth Reddy 2012-11-30 2842 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2843
f92363d1235949 Sreekanth Reddy 2012-11-30 2844 INIT_LIST_HEAD(&reply_q->list);
f92363d1235949 Sreekanth Reddy 2012-11-30 2845 list_add_tail(&reply_q->list, &ioc->reply_queue_list);
f92363d1235949 Sreekanth Reddy 2012-11-30 2846 return 0;
f92363d1235949 Sreekanth Reddy 2012-11-30 2847 }
f92363d1235949 Sreekanth Reddy 2012-11-30 2848
:::::: The code at line 2830 was first introduced by commit
:::::: f92363d12359498f9a9960511de1a550f0ec41c2 [SCSI] mpt3sas: add new driver supporting 12GB SAS
:::::: TO: Sreekanth Reddy <Sreekanth.Reddy@xxxxxxx>
:::::: CC: James Bottomley <JBottomley@xxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki