From: kernel test robot <lkp@intel.com>
To: Evan Quan <evan.quan@amd.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Alex Deucher <alexander.deucher@amd.com>,
Lijo Lazar <lijo.lazar@amd.com>,
Hawking Zhang <Hawking.Zhang@amd.com>
Subject: drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c:104:52: warning: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23
Date: Fri, 29 Dec 2023 07:02:49 +0800 [thread overview]
Message-ID: <202312290653.xdMUAh0o-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 505e701c0b2cfa9e34811020829759b7663a604c
commit: 276c03a0547068026241decd2c1159df0be5941f drm/amd/smu: Update SMU13 support for SMU 13.0.0
date: 1 year, 8 months ago
config: x86_64-randconfig-x066-20230529 (https://download.01.org/0day-ci/archive/20231229/202312290653.xdMUAh0o-lkp@intel.com/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/20231229/202312290653.xdMUAh0o-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312290653.xdMUAh0o-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c: In function 'smu_v13_0_init_microcode':
>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c:104:52: warning: '%s' directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
104 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name);
| ^~
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c:104:9: note: 'snprintf' output between 12 and 41 bytes into a destination of size 30
104 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +104 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0.c
76
77 static int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, void **table, uint32_t *size,
78 uint32_t pptable_id);
79
80 int smu_v13_0_init_microcode(struct smu_context *smu)
81 {
82 struct amdgpu_device *adev = smu->adev;
83 const char *chip_name;
84 char fw_name[30];
85 char ucode_prefix[30];
86 int err = 0;
87 const struct smc_firmware_header_v1_0 *hdr;
88 const struct common_firmware_header *header;
89 struct amdgpu_firmware_info *ucode = NULL;
90
91 /* doesn't need to load smu firmware in IOV mode */
92 if (amdgpu_sriov_vf(adev))
93 return 0;
94
95 switch (adev->ip_versions[MP1_HWIP][0]) {
96 case IP_VERSION(13, 0, 2):
97 chip_name = "aldebaran_smc";
98 break;
99 default:
100 amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
101 chip_name = ucode_prefix;
102 }
103
> 104 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", chip_name);
105
106 err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
107 if (err)
108 goto out;
109 err = amdgpu_ucode_validate(adev->pm.fw);
110 if (err)
111 goto out;
112
113 hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
114 amdgpu_ucode_print_smc_hdr(&hdr->header);
115 adev->pm.fw_version = le32_to_cpu(hdr->header.ucode_version);
116
117 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
118 ucode = &adev->firmware.ucode[AMDGPU_UCODE_ID_SMC];
119 ucode->ucode_id = AMDGPU_UCODE_ID_SMC;
120 ucode->fw = adev->pm.fw;
121 header = (const struct common_firmware_header *)ucode->fw->data;
122 adev->firmware.fw_size +=
123 ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
124 }
125
126 out:
127 if (err) {
128 DRM_ERROR("smu_v13_0: Failed to load firmware \"%s\"\n",
129 fw_name);
130 release_firmware(adev->pm.fw);
131 adev->pm.fw = NULL;
132 }
133 return err;
134 }
135
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-12-28 23:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202312290653.xdMUAh0o-lkp@intel.com \
--to=lkp@intel.com \
--cc=Hawking.Zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=evan.quan@amd.com \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.