drivers/scsi/lpfc/lpfc_init.c:14771:53: warning: '.grp' directive output may be truncated writing 4 bytes into a region of size between 1 and 80

From: kernel test robot
Date: Fri Nov 03 2023 - 18:26:21 EST


Hi Lad,

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: e392ea4d4d00880bf94550151b1ace4f88a4b17a
commit: effae0e3d9e1139d583e9b5d050f4f948825b8a3 riscv: Kconfig: Enable cpufreq kconfig menu
date: 12 months ago
config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20231104/202311040654.NBvWmrLg-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231104/202311040654.NBvWmrLg-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/202311040654.NBvWmrLg-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_sli4_request_firmware_update':
>> drivers/scsi/lpfc/lpfc_init.c:14771:53: warning: '.grp' directive output may be truncated writing 4 bytes into a region of size between 1 and 80 [-Wformat-truncation=]
14771 | snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName);
| ^~~~
drivers/scsi/lpfc/lpfc_init.c:14771:9: note: 'snprintf' output between 5 and 84 bytes into a destination of size 80
14771 | snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +14771 drivers/scsi/lpfc/lpfc_init.c

52d5244096017b James Smart 2011-05-24 14750
c71ab8616d62d8 James Smart 2012-10-31 14751 /**
c71ab8616d62d8 James Smart 2012-10-31 14752 * lpfc_sli4_request_firmware_update - Request linux generic firmware upgrade
c71ab8616d62d8 James Smart 2012-10-31 14753 * @phba: pointer to lpfc hba data structure.
fe614acd583f5e Lee Jones 2020-07-23 14754 * @fw_upgrade: which firmware to update.
c71ab8616d62d8 James Smart 2012-10-31 14755 *
c71ab8616d62d8 James Smart 2012-10-31 14756 * This routine is called to perform Linux generic firmware upgrade on device
c71ab8616d62d8 James Smart 2012-10-31 14757 * that supports such feature.
c71ab8616d62d8 James Smart 2012-10-31 14758 **/
c71ab8616d62d8 James Smart 2012-10-31 14759 int
c71ab8616d62d8 James Smart 2012-10-31 14760 lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade)
c71ab8616d62d8 James Smart 2012-10-31 14761 {
c71ab8616d62d8 James Smart 2012-10-31 14762 uint8_t file_name[ELX_MODEL_NAME_SIZE];
c71ab8616d62d8 James Smart 2012-10-31 14763 int ret;
c71ab8616d62d8 James Smart 2012-10-31 14764 const struct firmware *fw;
c71ab8616d62d8 James Smart 2012-10-31 14765
c71ab8616d62d8 James Smart 2012-10-31 14766 /* Only supported on SLI4 interface type 2 for now */
27d6ac0a6e8300 James Smart 2018-02-22 14767 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) <
c71ab8616d62d8 James Smart 2012-10-31 14768 LPFC_SLI_INTF_IF_TYPE_2)
c71ab8616d62d8 James Smart 2012-10-31 14769 return -EPERM;
c71ab8616d62d8 James Smart 2012-10-31 14770
c71ab8616d62d8 James Smart 2012-10-31 @14771 snprintf(file_name, ELX_MODEL_NAME_SIZE, "%s.grp", phba->ModelName);
c71ab8616d62d8 James Smart 2012-10-31 14772
c71ab8616d62d8 James Smart 2012-10-31 14773 if (fw_upgrade == INT_FW_UPGRADE) {
0733d83905326b Shawn Guo 2021-04-25 14774 ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT,
c71ab8616d62d8 James Smart 2012-10-31 14775 file_name, &phba->pcidev->dev,
c71ab8616d62d8 James Smart 2012-10-31 14776 GFP_KERNEL, (void *)phba,
c71ab8616d62d8 James Smart 2012-10-31 14777 lpfc_write_firmware);
c71ab8616d62d8 James Smart 2012-10-31 14778 } else if (fw_upgrade == RUN_FW_UPGRADE) {
c71ab8616d62d8 James Smart 2012-10-31 14779 ret = request_firmware(&fw, file_name, &phba->pcidev->dev);
c71ab8616d62d8 James Smart 2012-10-31 14780 if (!ret)
c71ab8616d62d8 James Smart 2012-10-31 14781 lpfc_write_firmware(fw, (void *)phba);
c71ab8616d62d8 James Smart 2012-10-31 14782 } else {
c71ab8616d62d8 James Smart 2012-10-31 14783 ret = -EINVAL;
c71ab8616d62d8 James Smart 2012-10-31 14784 }
c71ab8616d62d8 James Smart 2012-10-31 14785
c71ab8616d62d8 James Smart 2012-10-31 14786 return ret;
c71ab8616d62d8 James Smart 2012-10-31 14787 }
c71ab8616d62d8 James Smart 2012-10-31 14788

:::::: The code at line 14771 was first introduced by commit
:::::: c71ab8616d62d8d857c438f058839d9a0282e64c [SCSI] lpfc 8.3.36: Fixed boot from san failure

:::::: TO: James Smart <james.smart@xxxxxxxxxx>
:::::: CC: James Bottomley <JBottomley@xxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki