[linux-next:master 7871/8170] drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5e4f84f18c4ee9b0ccdc19e39b7de41df21699dd
commit: e88a7abec8376eaf588df9f79f76c170acf0396a [7871/8170] drm/amdgpu: init microcode chip name from ip versions
config: x86_64-buildonly-randconfig-003-20240424 (https://download.01.org/0day-ci/archive/20240424/202404242330.Fb2cmamD-lkp@xxxxxxxxx/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240424/202404242330.Fb2cmamD-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/202404242330.Fb2cmamD-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function 'gfx_v9_4_3_early_init':
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
     379 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
         |                                                    ^~
   ......
     439 |         r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
         |                                                 ~~~~~~~~~~~~
   In function 'gfx_v9_4_3_init_rlc_microcode',
       inlined from 'gfx_v9_4_3_init_microcode' at drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:439:6,
       inlined from 'gfx_v9_4_3_early_init' at drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:2257:9:
   drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: 'snprintf' output between 16 and 45 bytes into a destination of size 30
     379 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function 'gfx_v9_4_3_early_init':
   drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
     413 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
         |                                                    ^~
   ......
     443 |         r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
         |                                                        ~~~~~~~~~~~~
   In function 'gfx_v9_4_3_init_cp_compute_microcode',
       inlined from 'gfx_v9_4_3_init_microcode' at drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:443:6,
       inlined from 'gfx_v9_4_3_early_init' at drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:2257:9:
   drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: 'snprintf' output between 16 and 45 bytes into a destination of size 30
     413 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +379 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

86301129698be5 Le Ma 2022-05-24  369  
86301129698be5 Le Ma 2022-05-24  370  static int gfx_v9_4_3_init_rlc_microcode(struct amdgpu_device *adev,
86301129698be5 Le Ma 2022-05-24  371  					  const char *chip_name)
86301129698be5 Le Ma 2022-05-24  372  {
86301129698be5 Le Ma 2022-05-24  373  	char fw_name[30];
86301129698be5 Le Ma 2022-05-24  374  	int err;
86301129698be5 Le Ma 2022-05-24  375  	const struct rlc_firmware_header_v2_0 *rlc_hdr;
86301129698be5 Le Ma 2022-05-24  376  	uint16_t version_major;
86301129698be5 Le Ma 2022-05-24  377  	uint16_t version_minor;
86301129698be5 Le Ma 2022-05-24  378  
86301129698be5 Le Ma 2022-05-24 @379  	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
86301129698be5 Le Ma 2022-05-24  380  
86301129698be5 Le Ma 2022-05-24  381  	err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name);
86301129698be5 Le Ma 2022-05-24  382  	if (err)
86301129698be5 Le Ma 2022-05-24  383  		goto out;
86301129698be5 Le Ma 2022-05-24  384  	rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
86301129698be5 Le Ma 2022-05-24  385  
86301129698be5 Le Ma 2022-05-24  386  	version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
86301129698be5 Le Ma 2022-05-24  387  	version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
86301129698be5 Le Ma 2022-05-24  388  	err = amdgpu_gfx_rlc_init_microcode(adev, version_major, version_minor);
86301129698be5 Le Ma 2022-05-24  389  out:
86301129698be5 Le Ma 2022-05-24  390  	if (err)
86301129698be5 Le Ma 2022-05-24  391  		amdgpu_ucode_release(&adev->gfx.rlc_fw);
86301129698be5 Le Ma 2022-05-24  392  
86301129698be5 Le Ma 2022-05-24  393  	return err;
86301129698be5 Le Ma 2022-05-24  394  }
86301129698be5 Le Ma 2022-05-24  395  

:::::: The code at line 379 was first introduced by commit
:::::: 86301129698be52f8398f92ea8564168f6bfcae1 drm/amdgpu: split gc v9_4_3 functionality from gc v9_0

:::::: TO: Le Ma <le.ma@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux