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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202310181858.EyyD4USk-lkp@intel.com>
Date:   Wed, 18 Oct 2023 18:59:38 +0800
From:   kernel test robot <lkp@...el.com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: arch/powerpc/sysdev/xive/common.c:1845:50: warning: '%ld' directive
 output may be truncated writing between 1 and 20 bytes into a region of size
 13

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   06dc10eae55b5ceabfef287a7e5f16ceea204aa0
commit: 33e67710beda78aed38a2fe10be6088d4aeb1c53 cpumask: switch for_each_cpu{,_not} to use for_each_bit()
date:   1 year, 1 month ago
config: powerpc64-randconfig-r003-20230828 (https://download.01.org/0day-ci/archive/20231018/202310181858.EyyD4USk-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181858.EyyD4USk-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/202310181858.EyyD4USk-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/powerpc/sysdev/xive/common.c: In function 'xive_core_debug_init':
>> arch/powerpc/sysdev/xive/common.c:1845:50: warning: '%ld' directive output may be truncated writing between 1 and 20 bytes into a region of size 13 [-Wformat-truncation=]
    1845 |                 snprintf(name, sizeof(name), "cpu%ld", cpu);
         |                                                  ^~~
   In function 'xive_core_debugfs_create',
       inlined from 'xive_core_debug_init' at arch/powerpc/sysdev/xive/common.c:1861:3:
   arch/powerpc/sysdev/xive/common.c:1845:46: note: directive argument in the range [-9223372036854775808, 4294967294]
    1845 |                 snprintf(name, sizeof(name), "cpu%ld", cpu);
         |                                              ^~~~~~~~
   arch/powerpc/sysdev/xive/common.c:1845:17: note: 'snprintf' output between 5 and 24 bytes into a destination of size 16
    1845 |                 snprintf(name, sizeof(name), "cpu%ld", cpu);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   arch/powerpc/platforms/pseries/lpar.c: In function '__machine_initcall_pseries_vpa_debugfs_init':
>> arch/powerpc/platforms/pseries/lpar.c:2032:36: warning: '%ld' directive writing between 1 and 20 bytes into a region of size 12 [-Wformat-overflow=]
    2032 |                 sprintf(name, "cpu-%ld", i);
         |                                    ^~~
   In function 'vpa_debugfs_init',
       inlined from '__machine_initcall_pseries_vpa_debugfs_init' at arch/powerpc/platforms/pseries/lpar.c:2038:1:
   arch/powerpc/platforms/pseries/lpar.c:2032:31: note: directive argument in the range [-9223372036854775808, 4294967294]
    2032 |                 sprintf(name, "cpu-%ld", i);
         |                               ^~~~~~~~~
   arch/powerpc/platforms/pseries/lpar.c:2032:17: note: 'sprintf' output between 6 and 25 bytes into a destination of size 16
    2032 |                 sprintf(name, "cpu-%ld", i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1845 arch/powerpc/sysdev/xive/common.c

08f3f610214f39 Cédric Le Goater 2021-11-05  1827  
412877dfae3dc1 Cédric Le Goater 2021-11-05  1828  static void xive_core_debugfs_create(void)
930914b7d528fc Cédric Le Goater 2020-03-06  1829  {
baed14de78b5ee Cédric Le Goater 2021-11-05  1830  	struct dentry *xive_dir;
08f3f610214f39 Cédric Le Goater 2021-11-05  1831  	struct dentry *xive_eq_dir;
08f3f610214f39 Cédric Le Goater 2021-11-05  1832  	long cpu;
08f3f610214f39 Cédric Le Goater 2021-11-05  1833  	char name[16];
baed14de78b5ee Cédric Le Goater 2021-11-05  1834  
baed14de78b5ee Cédric Le Goater 2021-11-05  1835  	xive_dir = debugfs_create_dir("xive", arch_debugfs_dir);
baed14de78b5ee Cédric Le Goater 2021-11-05  1836  	if (IS_ERR(xive_dir))
baed14de78b5ee Cédric Le Goater 2021-11-05  1837  		return;
baed14de78b5ee Cédric Le Goater 2021-11-05  1838  
33e1d4a152ce55 Cédric Le Goater 2021-11-05  1839  	debugfs_create_file("ipis", 0400, xive_dir,
33e1d4a152ce55 Cédric Le Goater 2021-11-05  1840  			    NULL, &xive_ipi_debug_fops);
baed14de78b5ee Cédric Le Goater 2021-11-05  1841  	debugfs_create_file("interrupts", 0400, xive_dir,
baed14de78b5ee Cédric Le Goater 2021-11-05  1842  			    NULL, &xive_irq_debug_fops);
08f3f610214f39 Cédric Le Goater 2021-11-05  1843  	xive_eq_dir = debugfs_create_dir("eqs", xive_dir);
08f3f610214f39 Cédric Le Goater 2021-11-05  1844  	for_each_possible_cpu(cpu) {
08f3f610214f39 Cédric Le Goater 2021-11-05 @1845  		snprintf(name, sizeof(name), "cpu%ld", cpu);
08f3f610214f39 Cédric Le Goater 2021-11-05  1846  		debugfs_create_file(name, 0400, xive_eq_dir, (void *)cpu,
08f3f610214f39 Cédric Le Goater 2021-11-05  1847  				    &xive_eq_debug_fops);
08f3f610214f39 Cédric Le Goater 2021-11-05  1848  	}
d7bc1e376cb786 Cédric Le Goater 2021-11-05  1849  	debugfs_create_bool("store-eoi", 0600, xive_dir, &xive_store_eoi);
2a2ac8a7018b95 Cédric Le Goater 2021-12-01  1850  
2a2ac8a7018b95 Cédric Le Goater 2021-12-01  1851  	if (xive_ops->debug_create)
2a2ac8a7018b95 Cédric Le Goater 2021-12-01  1852  		xive_ops->debug_create(xive_dir);
412877dfae3dc1 Cédric Le Goater 2021-11-05  1853  }
412877dfae3dc1 Cédric Le Goater 2021-11-05  1854  #else
412877dfae3dc1 Cédric Le Goater 2021-11-05  1855  static inline void xive_core_debugfs_create(void) { }
412877dfae3dc1 Cédric Le Goater 2021-11-05  1856  #endif /* CONFIG_DEBUG_FS */
412877dfae3dc1 Cédric Le Goater 2021-11-05  1857  

:::::: The code at line 1845 was first introduced by commit
:::::: 08f3f610214f395561bbda03344e641579f6e917 powerpc/xive: Add a debugfs file to dump EQs

:::::: TO: Cédric Le Goater <clg@...d.org>
:::::: CC: Michael Ellerman <mpe@...erman.id.au>

-- 
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