[linux-next:master 14120/14158] drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:60:52: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 57

[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:   af3c30d33476bc2694b0d699173544b07f7ae7de
commit: 75736b3ff0253cb1246f9f65a0594b1369a2d8b6 [14120/14158] Merge branch 'drm-next' of https://gitlab.freedesktop.org/agd5f/linux
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230910/202309101830.7uQV4SMc-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230910/202309101830.7uQV4SMc-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/202309101830.7uQV4SMc-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c: In function 'amdgpu_vpe_init_microcode':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:60:52: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 57 [-Wformat-truncation=]
      60 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", fw_prefix);
         |                                                    ^~       ~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c:60:9: note: 'snprintf' output between 12 and 75 bytes into a destination of size 64
      60 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", fw_prefix);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +60 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c

f9ecae9a4ec19c2 Lang Yu 2023-06-27  50  
9d4346bdbc6484a Lang Yu 2022-05-23  51  int amdgpu_vpe_init_microcode(struct amdgpu_vpe *vpe)
9d4346bdbc6484a Lang Yu 2022-05-23  52  {
9d4346bdbc6484a Lang Yu 2022-05-23  53  	struct amdgpu_device *adev = vpe->ring.adev;
9d4346bdbc6484a Lang Yu 2022-05-23  54  	const struct vpe_firmware_header_v1_0 *vpe_hdr;
9d4346bdbc6484a Lang Yu 2022-05-23  55  	char fw_name[VPE_FW_NAME_LEN];
9d4346bdbc6484a Lang Yu 2022-05-23  56  	char fw_prefix[VPE_FW_NAME_LEN];
9d4346bdbc6484a Lang Yu 2022-05-23  57  	int ret;
9d4346bdbc6484a Lang Yu 2022-05-23  58  
9d4346bdbc6484a Lang Yu 2022-05-23  59  	amdgpu_ucode_ip_version_decode(adev, VPE_HWIP, fw_prefix, sizeof(fw_prefix));
9d4346bdbc6484a Lang Yu 2022-05-23 @60  	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", fw_prefix);
9d4346bdbc6484a Lang Yu 2022-05-23  61  
9d4346bdbc6484a Lang Yu 2022-05-23  62  	ret = amdgpu_ucode_request(adev, &adev->vpe.fw, fw_name);
9d4346bdbc6484a Lang Yu 2022-05-23  63  	if (ret)
9d4346bdbc6484a Lang Yu 2022-05-23  64  		goto out;
9d4346bdbc6484a Lang Yu 2022-05-23  65  
9d4346bdbc6484a Lang Yu 2022-05-23  66  	vpe_hdr = (const struct vpe_firmware_header_v1_0 *)adev->vpe.fw->data;
9d4346bdbc6484a Lang Yu 2022-05-23  67  	adev->vpe.fw_version = le32_to_cpu(vpe_hdr->header.ucode_version);
9d4346bdbc6484a Lang Yu 2022-05-23  68  	adev->vpe.feature_version = le32_to_cpu(vpe_hdr->ucode_feature_version);
9d4346bdbc6484a Lang Yu 2022-05-23  69  
c5d67a0ec3cc05e Lang Yu 2023-05-09  70  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
c5d67a0ec3cc05e Lang Yu 2023-05-09  71  		struct amdgpu_firmware_info *info;
c5d67a0ec3cc05e Lang Yu 2023-05-09  72  
c5d67a0ec3cc05e Lang Yu 2023-05-09  73  		info = &adev->firmware.ucode[AMDGPU_UCODE_ID_VPE_CTX];
c5d67a0ec3cc05e Lang Yu 2023-05-09  74  		info->ucode_id = AMDGPU_UCODE_ID_VPE_CTX;
c5d67a0ec3cc05e Lang Yu 2023-05-09  75  		info->fw = adev->vpe.fw;
c5d67a0ec3cc05e Lang Yu 2023-05-09  76  		adev->firmware.fw_size +=
c5d67a0ec3cc05e Lang Yu 2023-05-09  77  			ALIGN(le32_to_cpu(vpe_hdr->ctx_ucode_size_bytes), PAGE_SIZE);
c5d67a0ec3cc05e Lang Yu 2023-05-09  78  
c5d67a0ec3cc05e Lang Yu 2023-05-09  79  		info = &adev->firmware.ucode[AMDGPU_UCODE_ID_VPE_CTL];
c5d67a0ec3cc05e Lang Yu 2023-05-09  80  		info->ucode_id = AMDGPU_UCODE_ID_VPE_CTL;
c5d67a0ec3cc05e Lang Yu 2023-05-09  81  		info->fw = adev->vpe.fw;
c5d67a0ec3cc05e Lang Yu 2023-05-09  82  		adev->firmware.fw_size +=
c5d67a0ec3cc05e Lang Yu 2023-05-09  83  			ALIGN(le32_to_cpu(vpe_hdr->ctl_ucode_size_bytes), PAGE_SIZE);
c5d67a0ec3cc05e Lang Yu 2023-05-09  84  	}
c5d67a0ec3cc05e Lang Yu 2023-05-09  85  
9d4346bdbc6484a Lang Yu 2022-05-23  86  	return 0;
9d4346bdbc6484a Lang Yu 2022-05-23  87  out:
9d4346bdbc6484a Lang Yu 2022-05-23  88  	dev_err(adev->dev, "fail to initialize vpe microcode\n");
9d4346bdbc6484a Lang Yu 2022-05-23  89  	release_firmware(adev->vpe.fw);
9d4346bdbc6484a Lang Yu 2022-05-23  90  	adev->vpe.fw = NULL;
9d4346bdbc6484a Lang Yu 2022-05-23  91  	return ret;
9d4346bdbc6484a Lang Yu 2022-05-23  92  }
9d4346bdbc6484a Lang Yu 2022-05-23  93  

:::::: The code at line 60 was first introduced by commit
:::::: 9d4346bdbc6484a1814011315827c258509b483c drm/amdgpu: add VPE 6.1.0 support

:::::: TO: Lang Yu <Lang.Yu@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