mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.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
Date: Wed, 18 Oct 2023 18:59:38 +0800	[thread overview]
Message-ID: <202310181858.EyyD4USk-lkp@intel.com> (raw)

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@intel.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@kaod.org>
:::::: CC: Michael Ellerman <mpe@ellerman.id.au>

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

                 reply	other threads:[~2023-10-18 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202310181858.EyyD4USk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®