[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202310191331.IGbTQDtZ-lkp@intel.com>
Date: Thu, 19 Oct 2023 13:34:04 +0800
From: kernel test robot <lkp@...el.com>
To: Shai Malin <smalin@...vell.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Prabhakar Kushwaha <pkushwaha@...vell.com>,
Ariel Elior <aelior@...vell.com>
Subject: drivers/net/ethernet/qlogic/qede/qede_ethtool.c:631:37: warning:
'snprintf' output may be truncated before the last format character
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dd72f9c7e512da377074d47d990564959b772643
commit: 88ea96f8c14e39f7ee397b815de622ea5e1481ab qede: Remove the qede module version
date: 2 years, 3 months ago
config: sparc64-allyesconfig (https://download.01.org/0day-ci/archive/20231019/202310191331.IGbTQDtZ-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/202310191331.IGbTQDtZ-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/202310191331.IGbTQDtZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/qlogic/qede/qede_ethtool.c: In function 'qede_get_drvinfo':
>> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:631:37: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
631 | "[storm %s]", storm);
| ^
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:630:17: note: 'snprintf' output between 9 and 33 bytes into a destination of size 32
630 | snprintf(info->version, sizeof(info->version),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
631 | "[storm %s]", storm);
| ~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:648:31: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 28 [-Wformat-truncation=]
648 | "mfw %s", mfw);
| ^~ ~~~
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:647:17: note: 'snprintf' output between 5 and 36 bytes into a destination of size 32
647 | snprintf(info->fw_version, sizeof(info->fw_version),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
648 | "mfw %s", mfw);
| ~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:645:31: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 28 [-Wformat-truncation=]
645 | "mbi %s [mfw %s]", mbi, mfw);
| ^~ ~~~
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:644:17: note: 'snprintf' output between 12 and 74 bytes into a destination of size 32
644 | snprintf(info->fw_version, sizeof(info->fw_version),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
645 | "mbi %s [mfw %s]", mbi, mfw);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/snprintf +631 drivers/net/ethernet/qlogic/qede/qede_ethtool.c
606
607 static void qede_get_drvinfo(struct net_device *ndev,
608 struct ethtool_drvinfo *info)
609 {
610 char mfw[ETHTOOL_FWVERS_LEN], storm[ETHTOOL_FWVERS_LEN];
611 struct qede_dev *edev = netdev_priv(ndev);
612 char mbi[ETHTOOL_FWVERS_LEN];
613
614 strlcpy(info->driver, "qede", sizeof(info->driver));
615
616 snprintf(storm, ETHTOOL_FWVERS_LEN, "%d.%d.%d.%d",
617 edev->dev_info.common.fw_major,
618 edev->dev_info.common.fw_minor,
619 edev->dev_info.common.fw_rev,
620 edev->dev_info.common.fw_eng);
621
622 snprintf(mfw, ETHTOOL_FWVERS_LEN, "%d.%d.%d.%d",
623 (edev->dev_info.common.mfw_rev >> 24) & 0xFF,
624 (edev->dev_info.common.mfw_rev >> 16) & 0xFF,
625 (edev->dev_info.common.mfw_rev >> 8) & 0xFF,
626 edev->dev_info.common.mfw_rev & 0xFF);
627
628 if ((strlen(storm) + strlen("[storm]")) <
629 sizeof(info->version))
630 snprintf(info->version, sizeof(info->version),
> 631 "[storm %s]", storm);
632 else
633 snprintf(info->version, sizeof(info->version),
634 "%s", storm);
635
636 if (edev->dev_info.common.mbi_version) {
637 snprintf(mbi, ETHTOOL_FWVERS_LEN, "%d.%d.%d",
638 (edev->dev_info.common.mbi_version &
639 QED_MBI_VERSION_2_MASK) >> QED_MBI_VERSION_2_OFFSET,
640 (edev->dev_info.common.mbi_version &
641 QED_MBI_VERSION_1_MASK) >> QED_MBI_VERSION_1_OFFSET,
642 (edev->dev_info.common.mbi_version &
643 QED_MBI_VERSION_0_MASK) >> QED_MBI_VERSION_0_OFFSET);
644 snprintf(info->fw_version, sizeof(info->fw_version),
645 "mbi %s [mfw %s]", mbi, mfw);
646 } else {
647 snprintf(info->fw_version, sizeof(info->fw_version),
648 "mfw %s", mfw);
649 }
650
651 strlcpy(info->bus_info, pci_name(edev->pdev), sizeof(info->bus_info));
652 }
653
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists