drivers/net/ethernet/pensando/ionic/ionic_lif.c:37:11: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 25

From: kernel test robot
Date: Wed Nov 29 2023 - 16:37:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3b47bc037bd44f142ac09848e8d3ecccc726be99
commit: 1d062b7b6f6408fd43f447f90338cfade4168170 ionic: Add basic adminq support
date: 4 years, 3 months ago
config: x86_64-randconfig-014-20230906 (https://download.01.org/0day-ci/archive/20231130/202311300201.lO8v7mKU-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311300201.lO8v7mKU-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/202311300201.lO8v7mKU-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/net/ethernet/pensando/ionic/ionic_lif.c: In function 'ionic_lifs_init':
>> drivers/net/ethernet/pensando/ionic/ionic_lif.c:37:11: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 25 [-Wformat-truncation=]
"%s-%s-%s", IONIC_DRV_NAME, name, q->name);
^~
drivers/net/ethernet/pensando/ionic/ionic_lif.c:36:2: note: 'snprintf' output 8 or more bytes (assuming 39) into a destination of size 32
snprintf(intr->name, sizeof(intr->name),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s-%s-%s", IONIC_DRV_NAME, name, q->name);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +37 drivers/net/ethernet/pensando/ionic/ionic_lif.c

23
24 static int ionic_request_irq(struct ionic_lif *lif, struct ionic_qcq *qcq)
25 {
26 struct ionic_intr_info *intr = &qcq->intr;
27 struct device *dev = lif->ionic->dev;
28 struct ionic_queue *q = &qcq->q;
29 const char *name;
30
31 if (lif->registered)
32 name = lif->netdev->name;
33 else
34 name = dev_name(dev);
35
36 snprintf(intr->name, sizeof(intr->name),
> 37 "%s-%s-%s", IONIC_DRV_NAME, name, q->name);
38
39 return devm_request_irq(dev, intr->vector, ionic_isr,
40 0, intr->name, &qcq->napi);
41 }
42

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