Skip to contentSkip to conversation

drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:125:50: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8

DISCUSSION kernel test robot 1 participant 1 message Nov 3, 2023

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4652b8e4f3ffa48c706ec334f048c217a7d9750d
commit: 353d5c241e83c4de04ca5ec0d7922bfb0809aa25 dmaengine: dw-edma: Add HDMA DebugFS support
date:   5 months ago
config: parisc-randconfig-001-20231102 (https://download.01.org/0day-ci/archive/20231103/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231103/[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 >>):

drivers/dma/dw-edma/dw-hdma-v0-debugfs.c: In function 'dw_hdma_v0_debugfs_on':

>> drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:125:50: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Wformat-truncation=]
     125 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                                                  ^~
   In function 'dw_hdma_debugfs_regs_wr',
       inlined from 'dw_hdma_debugfs_regs' at drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:156:2,
       inlined from 'dw_hdma_v0_debugfs_on' at drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:169:2:
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:125:46: note: directive argument in the range [-2147483641, 65534]
     125 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                                              ^~~~~~~
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:125:17: note: 'snprintf' output between 10 and 20 bytes into a destination of size 16
     125 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c: In function 'dw_hdma_v0_debugfs_on':
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:142:50: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Wformat-truncation=]
     142 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                                                  ^~
   In function 'dw_hdma_debugfs_regs_rd',
       inlined from 'dw_hdma_debugfs_regs' at drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:157:2,
       inlined from 'dw_hdma_v0_debugfs_on' at drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:169:2:
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:142:46: note: directive argument in the range [-2147483641, 65534]
     142 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                                              ^~~~~~~
   drivers/dma/dw-edma/dw-hdma-v0-debugfs.c:142:17: note: 'snprintf' output between 10 and 20 bytes into a destination of size 16
     142 |                 snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +125 drivers/dma/dw-edma/dw-hdma-v0-debugfs.c

115
116 static void dw_hdma_debugfs_regs_wr(struct dw_edma *dw, struct dentry *dent)
117 {
118 struct dentry *regs_dent, *ch_dent;
119 char name[16];
120 int i;
121
122 regs_dent = debugfs_create_dir(WRITE_STR, dent);
123
124 for (i = 0; i < dw->wr_ch_cnt; i++) {

 > 125			snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i);

126
127 ch_dent = debugfs_create_dir(name, regs_dent);
128
129 dw_hdma_debugfs_regs_ch(dw, EDMA_DIR_WRITE, i, ch_dent);
130 }
131 }
132

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