Skip to contentSkip to conversation

arch/x86/kernel/cpu/microcode/amd.c:504:58: warning: 'h.bin' directive output may be truncated writing 5 bytes into a region of size between 1 and 7

PATCH kernel test robot 1 participant 1 message Aug 25, 2023 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6269320850097903b30be8f07a5c61d9f7592393
commit: 0396ebf8fb52069f18d7b947e9313c32b858a2f9 [12846/12910] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20230825/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230825/[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 >>):

arch/x86/kernel/cpu/microcode/amd.c: In function 'find_blobs_in_containers':

>> arch/x86/kernel/cpu/microcode/amd.c:504:58: warning: 'h.bin' directive output may be truncated writing 5 bytes into a region of size between 1 and 7 [-Wformat-truncation=]
     504 |                          "amd-ucode/microcode_amd_fam%.2xh.bin", family);
         |                                                          ^~~~~
   arch/x86/kernel/cpu/microcode/amd.c:503:17: note: 'snprintf' output between 35 and 41 bytes into a destination of size 36
     503 |                 snprintf(fw_name, sizeof(fw_name),
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     504 |                          "amd-ucode/microcode_amd_fam%.2xh.bin", family);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +504 arch/x86/kernel/cpu/microcode/amd.c

fe055896c040df Borislav Petkov 2015-10-20  493  
06b8534cb72837 Borislav Petkov 2016-10-25  494  static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
fe055896c040df Borislav Petkov 2015-10-20  495  {
fe055896c040df Borislav Petkov 2015-10-20  496  	char fw_name[36] = "amd-ucode/microcode_amd.bin";
9d48960414c708 Borislav Petkov 2021-10-21  497  	struct firmware fw;
9d48960414c708 Borislav Petkov 2021-10-21  498  
9d48960414c708 Borislav Petkov 2021-10-21  499  	if (IS_ENABLED(CONFIG_X86_32))
9d48960414c708 Borislav Petkov 2021-10-21  500  		return false;
fe055896c040df Borislav Petkov 2015-10-20  501  
fe055896c040df Borislav Petkov 2015-10-20  502  	if (family >= 0x15)
fe055896c040df Borislav Petkov 2015-10-20  503  		snprintf(fw_name, sizeof(fw_name),
fe055896c040df Borislav Petkov 2015-10-20 @504  			 "amd-ucode/microcode_amd_fam%.2xh.bin", family);
fe055896c040df Borislav Petkov 2015-10-20  505  
9d48960414c708 Borislav Petkov 2021-10-21  506  	if (firmware_request_builtin(&fw, fw_name)) {
9d48960414c708 Borislav Petkov 2021-10-21  507  		cp->size = fw.size;
9d48960414c708 Borislav Petkov 2021-10-21  508  		cp->data = (void *)fw.data;
9d48960414c708 Borislav Petkov 2021-10-21  509  		return true;
9d48960414c708 Borislav Petkov 2021-10-21  510  	}
9d48960414c708 Borislav Petkov 2021-10-21  511  
fe055896c040df Borislav Petkov 2015-10-20  512  	return false;
fe055896c040df Borislav Petkov 2015-10-20  513  }
fe055896c040df Borislav Petkov 2015-10-20  514  

:::::: The code at line 504 was first introduced by commit
:::::: fe055896c040df571e4ff56fb196d6845130057b x86/microcode: Merge the early microcode loader

:::::: TO: Borislav Petkov <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

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