tree:
https://github.com/km13park/linux-1.git master
head: 77464b203e49ef9c4d957061005b4d54b0c5e633
commit: 4dab1d6923971a00f7de82497cb99b0a2a54f6d2 [2/3] drivers/saf: Introduce Scan At
Field driver
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
#
https://github.com/km13park/linux-1/commit/4dab1d6923971a00f7de82497cb99b...
git remote add km13park-linux-1
https://github.com/km13park/linux-1.git
git fetch --no-tags km13park-linux-1 master
git checkout 4dab1d6923971a00f7de82497cb99b0a2a54f6d2
# save the attached .config to linux build tree
make W=1 W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/scan_at_field/scan_at_field.c: In function 'load_scan_binary':
> drivers/scan_at_field/scan_at_field.c:210:10: warning: returning
'long int' from a function with return type 'const struct firmware *'
makes pointer from integer without a cast [-Wint-conversion]
210 | return
PTR_ERR(saf_pdev);
| ^~~~~~~~~~~~~~~~~
drivers/scan_at_field/scan_at_field.c: In function 'test_init':
drivers/scan_at_field/scan_at_field.c:332:17: warning: variable 'root' set but
not used [-Wunused-but-set-variable]
332 | struct device *root;
| ^~~~
drivers/scan_at_field/scan_at_field.c: In function 'load_scan_binaries':
> drivers/scan_at_field/scan_at_field.c:303:1: warning: the frame
size of 9248 bytes is larger than 8192 bytes [-Wframe-larger-than=]
303 | }
| ^
vim +210 drivers/scan_at_field/scan_at_field.c
197
198 /*
199 * Scan binary blob loading. Intel distributes the scan binary blob to vendors
200 * and vendor installed the hash and scan binary blobs to /lib/firmware/intel-saf.
201 */
202 static const struct firmware *load_scan_binary(const char *path, bool is_hash)
203 {
204 const struct firmware *fw;
205 int err;
206
207 saf_pdev = platform_device_register_simple("saf", -1, NULL, 0);
208 if (IS_ERR(saf_pdev)) {
209 pr_err("Error: platform_device_register_simple");
210 return PTR_ERR(saf_pdev);
211 }
212 err = request_firmware_direct(&fw, path, &saf_pdev->dev);
213 if (err) {
214 pr_err("Error: request_firmware_direct return");
215 goto out;
216 }
217
218 if (is_hash && !scan_blob_sanity_check((void *)fw->data)) {
219 pr_err("scan blob header sanity check failed");
220 goto out;
221 }
222 out:
223 platform_device_unregister(saf_pdev);
224
225 return fw;
226 }
227
228 /*
229 * Compare the binary blob version whenever loading a new binary blob.
230 * Load the new binary blob only if it is later or equal than the current version.
231 */
232 static bool has_newer_binary_blob(char *current_blob_ptr, char *new_blob_ptr)
233 {
234 if (!current_blob_ptr)
235 return true;
236
237 else if ((*(current_blob_ptr + BINARY_LOADER_VERSION_OFFSET) & 0xff) >
238 (*(new_blob_ptr + BINARY_LOADER_VERSION_OFFSET) & 0xff))
239 return false;
240
241 return true;
242 }
243
244 /*
245 * Load scan hash and data binaries. Scan hash copy and authentication must be run
on
246 * the first cpu for each package.
247 * The first byte of scan hash holds the information to determine whether it is for
scan
248 * at field or not.
249 */
250 int load_scan_binaries(void)
251 {
252 bool package_authenticated[NR_CPUS] = { [0 ... NR_CPUS - 1] = 0 };
253 char name[20], hash_path[256], scan_path[256];
254 const struct firmware *hash_fw, *test_fw;
255 int cpu, ret, curr_pkg;
256 u64 current_blob_ptr;
257
258 snprintf(name, sizeof(name), "%02x-%02x-%02x", boot_cpu_data.x86,
boot_cpu_data.x86_model,
259 boot_cpu_data.x86_stepping);
260
261 /* scan hash and test files will be named as "ff-mm--ss.hash" and
"ff-mm--ss.scan" */
262 snprintf(hash_path, sizeof(hash_path), "%s%s%s", saf_path, name,
".hash");
263 snprintf(scan_path, sizeof(scan_path), "%s%s%s", saf_path, name,
".scan");
264
265 current_blob_ptr = saf_params.hash_blob_ptr;
266
267 /* load the scan hash and authenticate per package */
268 for_each_online_cpu(cpu) {
269 curr_pkg = topology_physical_package_id(cpu);
270 if (package_authenticated[curr_pkg])
271 continue;
272 package_authenticated[curr_pkg] = 1;
273
274 hash_fw = load_scan_binary(hash_path, 1);
275 if (!hash_fw)
276 goto out;
277
278 if (!has_newer_binary_blob((char *)current_blob_ptr, (char *)hash_fw->data))
279 goto out;
280
281 saf_params.hash_blob_ptr = (u64)hash_fw->data;
282
283 if (*(hash_fw->data) == SCAN_PROGRAM) {
284 test_fw = load_scan_binary(scan_path, 0);
285 } else {
286 pr_err("wrong module type for scan test");
287 goto out;
288 }
289 if (!test_fw)
290 goto out;
291
292 saf_params.test_blob_ptr = (u64)test_fw->data;
293
294 ret = smp_call_function_single(cpu, (void *)copy_scan_hashes_authenticate, NULL,
1);
295 if (ret)
296 return -EINVAL;
297 }
298 out:
299 release_firmware(hash_fw);
300 release_firmware(test_fw);
301
302 return 0;
303 }
304
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org