drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:776:9: warning: '.bin' directive output may be truncated writing 4 bytes into a region of size between 3 and 11

From: kernel test robot
Date: Wed Oct 18 2023 - 08:32:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06dc10eae55b5ceabfef287a7e5f16ceea204aa0
commit: b217127e5e4ee0ecfce7c5f84cfe082238123bda mlxsw: core_linecards: Add line card objects and implement provisioning
date: 1 year, 6 months ago
config: riscv-randconfig-r001-20230902 (https://download.01.org/0day-ci/archive/20231018/202310182014.0kOuH8vx-lkp@xxxxxxxxx/config)
compiler: riscv32-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310182014.0kOuH8vx-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310182014.0kOuH8vx-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/net/ethernet/mellanox/mlxsw/core_linecards.c: In function 'mlxsw_linecard_types_init.isra':
>> drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:776:9: warning: '.bin' directive output may be truncated writing 4 bytes into a region of size between 3 and 11 [-Wformat-truncation=]
776 | "mellanox/lc_ini_bundle_%u_%u.bin"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:790:24: note: in expansion of macro 'MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT'
790 | MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:776:38: note: format string is defined here
776 | "mellanox/lc_ini_bundle_%u_%u.bin"
| ^~~~
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:789:15: note: 'snprintf' output between 31 and 39 bytes into a destination of size 37
789 | err = snprintf(filename, sizeof(filename),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
790 | MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
791 | rev->minor, rev->subminor);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +776 drivers/net/ethernet/mellanox/mlxsw/core_linecards.c

774
775 #define MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT \
> 776 "mellanox/lc_ini_bundle_%u_%u.bin"
777 #define MLXSW_LINECARDS_INI_BUNDLE_FILENAME_LEN \
778 (sizeof(MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT) + 4)
779

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