drivers/net/wireless/ath/ath10k/core.c:893:50: warning: '%s' directive output may be truncated writing up to 99 bytes into a region of size between 98 and 99

From: kernel test robot
Date: Fri Jan 05 2024 - 20:23:11 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a4ab2706bb1280693e7dff1c5c42a8cb9d70c177
commit: f2a7064a78b22f2b68b9fcbc8a6f4c5e61c5ba64 ath10k: support bus and device specific API 1 BDF selection
date: 1 year, 8 months ago
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240106/202401060901.bCLLpa8q-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240106/202401060901.bCLLpa8q-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/202401060901.bCLLpa8q-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/net/wireless/ath/ath10k/core.c: In function 'ath10k_core_fetch_board_file':
>> drivers/net/wireless/ath/ath10k/core.c:893:50: warning: '%s' directive output may be truncated writing up to 99 bytes into a region of size between 98 and 99 [-Wformat-truncation=]
893 | snprintf(filename, sizeof(filename), "%s/%s", dir, file);
| ^~
......
1247 | ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
| ~~~~~~~~~~~~~~~~~~~~~~~~
1248 | ar->hw_params.fw.dir,
| ~~~~~~~~~~~~~~~~~~~~~
1249 | boardname);
| ~~~~~~~~~~
In function 'ath10k_fetch_fw_file',
inlined from 'ath10k_core_fetch_board_data_api_1' at drivers/net/wireless/ath/ath10k/core.c:1247:30,
inlined from 'ath10k_core_fetch_board_file' at drivers/net/wireless/ath/ath10k/core.c:1620:8:
drivers/net/wireless/ath/ath10k/core.c:893:9: note: 'snprintf' output 2 or more bytes (assuming 102) into a destination of size 100
893 | snprintf(filename, sizeof(filename), "%s/%s", dir, file);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +893 drivers/net/wireless/ath/ath10k/core.c

5e3dd157d7e70f Kalle Valo 2013-06-12 878
5e3dd157d7e70f Kalle Valo 2013-06-12 879 static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
5e3dd157d7e70f Kalle Valo 2013-06-12 880 const char *dir,
5e3dd157d7e70f Kalle Valo 2013-06-12 881 const char *file)
5e3dd157d7e70f Kalle Valo 2013-06-12 882 {
5e3dd157d7e70f Kalle Valo 2013-06-12 883 char filename[100];
5e3dd157d7e70f Kalle Valo 2013-06-12 884 const struct firmware *fw;
5e3dd157d7e70f Kalle Valo 2013-06-12 885 int ret;
5e3dd157d7e70f Kalle Valo 2013-06-12 886
5e3dd157d7e70f Kalle Valo 2013-06-12 887 if (file == NULL)
5e3dd157d7e70f Kalle Valo 2013-06-12 888 return ERR_PTR(-ENOENT);
5e3dd157d7e70f Kalle Valo 2013-06-12 889
5e3dd157d7e70f Kalle Valo 2013-06-12 890 if (dir == NULL)
5e3dd157d7e70f Kalle Valo 2013-06-12 891 dir = ".";
5e3dd157d7e70f Kalle Valo 2013-06-12 892
5e3dd157d7e70f Kalle Valo 2013-06-12 @893 snprintf(filename, sizeof(filename), "%s/%s", dir, file);
c8e028026387ea Andres Rodriguez 2018-05-10 894 ret = firmware_request_nowarn(&fw, filename, ar->dev);
9f5bcfe93315d7 Michal Kazior 2017-02-13 895 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
9f5bcfe93315d7 Michal Kazior 2017-02-13 896 filename, ret);
9f5bcfe93315d7 Michal Kazior 2017-02-13 897
5e3dd157d7e70f Kalle Valo 2013-06-12 898 if (ret)
5e3dd157d7e70f Kalle Valo 2013-06-12 899 return ERR_PTR(ret);
5e3dd157d7e70f Kalle Valo 2013-06-12 900
5e3dd157d7e70f Kalle Valo 2013-06-12 901 return fw;
5e3dd157d7e70f Kalle Valo 2013-06-12 902 }
5e3dd157d7e70f Kalle Valo 2013-06-12 903

:::::: The code at line 893 was first introduced by commit
:::::: 5e3dd157d7e70f0e3cea3f2573ed69fb156a19d5 ath10k: mac80211 driver for Qualcomm Atheros 802.11ac CQA98xx devices

:::::: TO: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
:::::: CC: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>

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