Skip to contentSkip to conversation

drivers/usb/typec/mux/intel_pmc_mux.c:664:43: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size 2

DISCUSSION kernel test robot 1 participant 1 message Dec 3, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Hi Rajat,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cdd30ebb1b9f36159d66f088b61aee264e649d7a
commit: 0a453dc9f260281e3a063e07b526a7e494e496fe usb: typec: intel_pmc_mux: Expose IOM port status to debugfs
date:   1 year, 6 months ago
config: x86_64-buildonly-randconfig-002-20240106 (https://download.01.org/0day-ci/archive/20241203/[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/20241203/[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/usb/typec/mux/intel_pmc_mux.c: In function 'pmc_usb_probe':

>> drivers/usb/typec/mux/intel_pmc_mux.c:664:43: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=]
     664 |         snprintf(name, sizeof(name), "port%d", port->usb3_port - 1);
         |                                           ^~
   In function 'pmc_mux_port_debugfs_init',
       inlined from 'pmc_usb_probe' at drivers/usb/typec/mux/intel_pmc_mux.c:723:3:
   drivers/usb/typec/mux/intel_pmc_mux.c:664:38: note: directive argument in the range [-1, 254]
     664 |         snprintf(name, sizeof(name), "port%d", port->usb3_port - 1);
         |                                      ^~~~~~~~
   drivers/usb/typec/mux/intel_pmc_mux.c:664:9: note: 'snprintf' output between 6 and 8 bytes into a destination of size 6
     664 |         snprintf(name, sizeof(name), "port%d", port->usb3_port - 1);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +664 drivers/usb/typec/mux/intel_pmc_mux.c

658
659 static void pmc_mux_port_debugfs_init(struct pmc_usb_port *port)
660 {
661 struct dentry *debugfs_dir;
662 char name[6];
663

 > 664		snprintf(name, sizeof(name), "port%d", port->usb3_port - 1);

665
666 debugfs_dir = debugfs_create_dir(name, port->pmc->dentry);
667 debugfs_create_file("iom_status", 0400, debugfs_dir, port,
668 &port_iom_status_fops);
669 }
670

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