[linux-next:master 6727/7876] drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c:80:52: error: '%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:   a59668a9397e7245b26e9be85d23f242ff757ae8
commit: 377b5b397d073c0aae36b833a5bcac0e6f349243 [6727/7876] Merge tag 'amd-drm-next-6.10-2024-04-19' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
config: microblaze-allmodconfig (https://download.01.org/0day-ci/archive/20240424/202404240740.I4CcAi2r-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240424/202404240740.I4CcAi2r-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/202404240740.I4CcAi2r-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c: In function 'smu_v14_0_init_microcode':
>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c:80:52: error: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23 [-Werror=format-truncation=]
      80 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
         |                                                    ^~       ~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c:80:9: note: 'snprintf' output between 12 and 41 bytes into a destination of size 30
      80 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +80 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu14/smu_v14_0.c

2c79b0bca2bac7 Tim Huang    2024-01-30   63  
fe6cd9152464ed Kenneth Feng 2023-04-26   64  int smu_v14_0_init_microcode(struct smu_context *smu)
fe6cd9152464ed Kenneth Feng 2023-04-26   65  {
fe6cd9152464ed Kenneth Feng 2023-04-26   66  	struct amdgpu_device *adev = smu->adev;
fe6cd9152464ed Kenneth Feng 2023-04-26   67  	char fw_name[30];
fa62c03917732e Kenneth Feng 2023-04-26   68  	char ucode_prefix[30];
fe6cd9152464ed Kenneth Feng 2023-04-26   69  	int err = 0;
fe6cd9152464ed Kenneth Feng 2023-04-26   70  	const struct smc_firmware_header_v1_0 *hdr;
fe6cd9152464ed Kenneth Feng 2023-04-26   71  	const struct common_firmware_header *header;
fe6cd9152464ed Kenneth Feng 2023-04-26   72  	struct amdgpu_firmware_info *ucode = NULL;
fe6cd9152464ed Kenneth Feng 2023-04-26   73  
fe6cd9152464ed Kenneth Feng 2023-04-26   74  	/* doesn't need to load smu firmware in IOV mode */
fe6cd9152464ed Kenneth Feng 2023-04-26   75  	if (amdgpu_sriov_vf(adev))
fe6cd9152464ed Kenneth Feng 2023-04-26   76  		return 0;
fe6cd9152464ed Kenneth Feng 2023-04-26   77  
fe6cd9152464ed Kenneth Feng 2023-04-26   78  	amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
fe6cd9152464ed Kenneth Feng 2023-04-26   79  
fe6cd9152464ed Kenneth Feng 2023-04-26  @80  	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
fe6cd9152464ed Kenneth Feng 2023-04-26   81  
fe6cd9152464ed Kenneth Feng 2023-04-26   82  	err = amdgpu_ucode_request(adev, &adev->pm.fw, fw_name);
fe6cd9152464ed Kenneth Feng 2023-04-26   83  	if (err)
fe6cd9152464ed Kenneth Feng 2023-04-26   84  		goto out;
fe6cd9152464ed Kenneth Feng 2023-04-26   85  
fe6cd9152464ed Kenneth Feng 2023-04-26   86  	hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
fe6cd9152464ed Kenneth Feng 2023-04-26   87  	amdgpu_ucode_print_smc_hdr(&hdr->header);
fe6cd9152464ed Kenneth Feng 2023-04-26   88  	adev->pm.fw_version = le32_to_cpu(hdr->header.ucode_version);
fe6cd9152464ed Kenneth Feng 2023-04-26   89  
fe6cd9152464ed Kenneth Feng 2023-04-26   90  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
fe6cd9152464ed Kenneth Feng 2023-04-26   91  		ucode = &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC];
fe6cd9152464ed Kenneth Feng 2023-04-26   92  		ucode->ucode_id = AMDGPU_UCODE_ID_SMC;
fe6cd9152464ed Kenneth Feng 2023-04-26   93  		ucode->fw = adev->pm.fw;
fe6cd9152464ed Kenneth Feng 2023-04-26   94  		header = (const struct common_firmware_header *)ucode->fw->data;
fe6cd9152464ed Kenneth Feng 2023-04-26   95  		adev->firmware.fw_size +=
fe6cd9152464ed Kenneth Feng 2023-04-26   96  			ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
fe6cd9152464ed Kenneth Feng 2023-04-26   97  	}
fe6cd9152464ed Kenneth Feng 2023-04-26   98  
fe6cd9152464ed Kenneth Feng 2023-04-26   99  out:
fe6cd9152464ed Kenneth Feng 2023-04-26  100  	if (err)
fe6cd9152464ed Kenneth Feng 2023-04-26  101  		amdgpu_ucode_release(&adev->pm.fw);
fe6cd9152464ed Kenneth Feng 2023-04-26  102  	return err;
fe6cd9152464ed Kenneth Feng 2023-04-26  103  }
fe6cd9152464ed Kenneth Feng 2023-04-26  104  

:::::: The code at line 80 was first introduced by commit
:::::: fe6cd9152464ed086fbeb45b6118ca386ee7aca2 drm/amd/swsmu: add smu14 ip support

:::::: TO: Kenneth Feng <kenneth.feng@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