[drm-tip:drm-tip 4/11] drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:105:73: error: '.bin' directive output may be truncated writing 4 bytes into a region of size between 2 and 31

kernel test robot lkp at intel.com
Sat Mar 23 17:14:08 UTC 2024


tree:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
head:   657dd8fcd2f1d1205c6f98fdb8b60915228991d1
commit: 0885186926a13c697d78f5af03f32445414b6ad5 [4/11] Merge remote-tracking branch 'drm-misc/drm-misc-next' into drm-tip
config: microblaze-allmodconfig (https://download.01.org/0day-ci/archive/20240324/202403240115.1lAo588s-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240324/202403240115.1lAo588s-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403240115.1lAo588s-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c: In function 'amdgpu_vcn_early_init':
   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:66: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
     102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
         |                                                                  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:17: note: 'snprintf' output between 12 and 41 bytes into a destination of size 40
     102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:105:73: error: '.bin' directive output may be truncated writing 4 bytes into a region of size between 2 and 31 [-Werror=format-truncation=]
     105 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_%d.bin", ucode_prefix, i);
         |                                                                         ^~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:105:25: note: 'snprintf' output between 14 and 43 bytes into a destination of size 40
     105 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_%d.bin", ucode_prefix, i);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +105 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c

95d0906f850655 Leo Liu            2016-12-21   93  
69939009bde70c Mario Limonciello  2022-12-28   94  int amdgpu_vcn_early_init(struct amdgpu_device *adev)
69939009bde70c Mario Limonciello  2022-12-28   95  {
69939009bde70c Mario Limonciello  2022-12-28   96  	char ucode_prefix[30];
69939009bde70c Mario Limonciello  2022-12-28   97  	char fw_name[40];
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06   98  	int r, i;
69939009bde70c Mario Limonciello  2022-12-28   99  
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  100  	for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
69939009bde70c Mario Limonciello  2022-12-28  101  		amdgpu_ucode_ip_version_decode(adev, UVD_HWIP, ucode_prefix, sizeof(ucode_prefix));
69939009bde70c Mario Limonciello  2022-12-28 @102  		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  103  		if (amdgpu_ip_version(adev, UVD_HWIP, 0) ==  IP_VERSION(4, 0, 6) &&
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  104  			i == 1) {
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06 @105  			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_%d.bin", ucode_prefix, i);
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  106  		}
69939009bde70c Mario Limonciello  2022-12-28  107  
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  108  		r = amdgpu_ucode_request(adev, &adev->vcn.fw[i], fw_name);
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  109  		if (r) {
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  110  			amdgpu_ucode_release(&adev->vcn.fw[i]);
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  111  			return r;
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  112  		}
6a7cbbc267c0ca Saleemkhan Jamadar 2024-03-06  113  	}
69939009bde70c Mario Limonciello  2022-12-28  114  	return r;
69939009bde70c Mario Limonciello  2022-12-28  115  }
69939009bde70c Mario Limonciello  2022-12-28  116  

:::::: The code at line 105 was first introduced by commit
:::::: 6a7cbbc267c0cafa2b027983a40276deb673c066 drm/amdgpu/vcn: enable vcn1 fw load for VCN 4_0_6

:::::: TO: Saleemkhan Jamadar <saleemkhan.jamadar at amd.com>
:::::: CC: Alex Deucher <alexander.deucher at amd.com>

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


More information about the Intel-gfx mailing list