lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202412031726.c8OLuPOm-lkp@intel.com>
Date: Tue, 3 Dec 2024 17:54:52 +0800
From: kernel test robot <lkp@...el.com>
To: WANG Xuerui <git@...0n.name>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Huacai Chen <chenhuacai@...nel.org>
Subject: drivers/vdpa/pds/debugfs.c:266:49: warning: '%02d' directive output
 may be truncated writing between 2 and 11 bytes into a region of size 6

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cdd30ebb1b9f36159d66f088b61aee264e649d7a
commit: 3f301dc292eb122eff61b8b2906e519154b0327f LoongArch: Replace -ffreestanding with finer-grained -fno-builtin's
date:   1 year, 3 months ago
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20241203/202412031726.c8OLuPOm-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412031726.c8OLuPOm-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/202412031726.c8OLuPOm-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/vdpa/pds/debugfs.c: In function 'pds_vdpa_debugfs_add_vdpadev':
>> drivers/vdpa/pds/debugfs.c:266:49: warning: '%02d' directive output may be truncated writing between 2 and 11 bytes into a region of size 6 [-Wformat-truncation=]
     266 |                 snprintf(name, sizeof(name), "vq%02d", i);
         |                                                 ^~~~
   drivers/vdpa/pds/debugfs.c:266:46: note: directive argument in the range [-2147483641, 254]
     266 |                 snprintf(name, sizeof(name), "vq%02d", i);
         |                                              ^~~~~~~~
   drivers/vdpa/pds/debugfs.c:266:17: note: 'snprintf' output between 5 and 14 bytes into a destination of size 8
     266 |                 snprintf(name, sizeof(name), "vq%02d", i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/net/wireless/intersil/p54/fwio.c: In function 'p54_parse_firmware':
>> drivers/net/wireless/intersil/p54/fwio.c:128:34: warning: '%s' directive output may be truncated writing up to 39 bytes into a region of size 32 [-Wformat-truncation=]
     128 |                                 "%s - %x.%x", fw_version,
         |                                  ^~
   drivers/net/wireless/intersil/p54/fwio.c:128:33: note: directive argument in the range [0, 16777215]
     128 |                                 "%s - %x.%x", fw_version,
         |                                 ^~~~~~~~~~~~
   drivers/net/wireless/intersil/p54/fwio.c:128:33: note: directive argument in the range [0, 255]
   drivers/net/wireless/intersil/p54/fwio.c:127:17: note: 'snprintf' output between 7 and 52 bytes into a destination of size 32
     127 |                 snprintf(dev->wiphy->fw_version, sizeof(dev->wiphy->fw_version),
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     128 |                                 "%s - %x.%x", fw_version,
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
     129 |                                 priv->fw_var >> 8, priv->fw_var & 0xff);
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/net/ethernet/marvell/octeontx2/af/cgx.c: In function 'cgx_lmac_init':
>> drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1662:49: warning: '%d' directive writing between 1 and 11 bytes into a region of size between 4 and 6 [-Wformat-overflow=]
    1662 |                 sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i);
         |                                                 ^~
   drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1662:37: note: directive argument in the range [-2147483641, 254]
    1662 |                 sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i);
         |                                     ^~~~~~~~~~~~~~~
   drivers/net/ethernet/marvell/octeontx2/af/cgx.c:1662:17: note: 'sprintf' output between 12 and 24 bytes into a destination of size 16
    1662 |                 sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c: In function 'rvu_dbg_mcs_init':
>> drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:533:36: warning: '%d' directive writing between 1 and 11 bytes into a region of size 7 [-Wformat-overflow=]
     533 |                 sprintf(dname, "mcs%d", i);
         |                                    ^~
   drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:533:32: note: directive argument in the range [-2147483641, 2147483646]
     533 |                 sprintf(dname, "mcs%d", i);
         |                                ^~~~~~~
   drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:533:17: note: 'sprintf' output between 5 and 15 bytes into a destination of size 10
     533 |                 sprintf(dname, "mcs%d", i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +266 drivers/vdpa/pds/debugfs.c

151cc834f3ddaf Shannon Nelson 2023-05-19  256  
151cc834f3ddaf Shannon Nelson 2023-05-19  257  void pds_vdpa_debugfs_add_vdpadev(struct pds_vdpa_aux *vdpa_aux)
151cc834f3ddaf Shannon Nelson 2023-05-19  258  {
151cc834f3ddaf Shannon Nelson 2023-05-19  259  	int i;
151cc834f3ddaf Shannon Nelson 2023-05-19  260  
151cc834f3ddaf Shannon Nelson 2023-05-19  261  	debugfs_create_file("config", 0400, vdpa_aux->dentry, vdpa_aux->pdsv, &config_fops);
151cc834f3ddaf Shannon Nelson 2023-05-19  262  
151cc834f3ddaf Shannon Nelson 2023-05-19  263  	for (i = 0; i < vdpa_aux->pdsv->num_vqs; i++) {
151cc834f3ddaf Shannon Nelson 2023-05-19  264  		char name[8];
151cc834f3ddaf Shannon Nelson 2023-05-19  265  
151cc834f3ddaf Shannon Nelson 2023-05-19 @266  		snprintf(name, sizeof(name), "vq%02d", i);
151cc834f3ddaf Shannon Nelson 2023-05-19  267  		debugfs_create_file(name, 0400, vdpa_aux->dentry,
151cc834f3ddaf Shannon Nelson 2023-05-19  268  				    &vdpa_aux->pdsv->vqs[i], &vq_fops);
151cc834f3ddaf Shannon Nelson 2023-05-19  269  	}
151cc834f3ddaf Shannon Nelson 2023-05-19  270  }
151cc834f3ddaf Shannon Nelson 2023-05-19  271  

:::::: The code at line 266 was first introduced by commit
:::::: 151cc834f3ddafec869269fe48036460d920d08a pds_vdpa: add support for vdpa and vdpamgmt interfaces

:::::: TO: Shannon Nelson <shannon.nelson@....com>
:::::: CC: Michael S. Tsirkin <mst@...hat.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ