Skip to contentSkip to conversation

kernel/irq/debugfs.c:233:26: warning: 'sprintf' may write a terminating nul past the end of the destination

PATCH kernel test robot 2 participants 2 messages May 15, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
head:   58eb5721a445ea0af310d1410d7117a1910627bc
commit: 47af06c9d31fe558493de4e04f9a07847dc4992f [55/56] genirq: Consistently use '%u' format specifier for unsigned int variables
config: x86_64-randconfig-123-20250515 (https://download.01.org/0day-ci/archive/20250515/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250515/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

kernel/irq/debugfs.c: In function 'irq_debugfs_init':

>> kernel/irq/debugfs.c:233:26: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
     233 |         sprintf(name, "%u", irq);
         |                          ^
   In function 'irq_add_debugfs_entry',
       inlined from 'irq_add_debugfs_entry' at kernel/irq/debugfs.c:226:6,
       inlined from 'irq_debugfs_init' at kernel/irq/debugfs.c:251:3:
   kernel/irq/debugfs.c:233:9: note: 'sprintf' output between 2 and 11 bytes into a destination of size 10
     233 |         sprintf(name, "%u", irq);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~

vim +/sprintf +233 kernel/irq/debugfs.c

225
226 void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *desc)
227 {
228 char name [10];
229
230 if (!irq_dir || !desc || desc->debugfs_file)
231 return;
232

 > 233		sprintf(name, "%u", irq);

234 desc->debugfs_file = debugfs_create_file(name, 0644, irq_dir, desc,
235 &dfs_irq_ops);
236 }
237

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 11 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
head:   58eb5721a445ea0af310d1410d7117a1910627bc
commit: 47af06c9d31fe558493de4e04f9a07847dc4992f [55/56] genirq: Consistently use '%u' format specifier for unsigned int variables
config: x86_64-randconfig-123-20250515 (https://download.01.org/0day-ci/archive/20250515/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250515/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Definitely not my change was a culprit, but this one is easy to fix, I'll send a patch later this week.

Signature · 2 lines
With Best Regards,
Andy Shevchenko