Re: [PATCH 02/10] efi: Add a helper function to split 64-bit values

From: kbuild test robot
Date: Wed Apr 29 2020 - 19:51:32 EST


Hi Arvind,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on efi/next]
[also build test WARNING on next-20200429]
[cannot apply to v5.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Arvind-Sankar/efi-some-cleanups-refactoring-for-efi-next/20200430-051025
base: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
config: i386-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/firmware/efi/libstub/x86-stub.c: In function 'efi_pe_entry':
>> drivers/firmware/efi/libstub/x86-stub.c:411:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
efi_set_u64_split((u64)cmdline_ptr,
^
drivers/firmware/efi/libstub/x86-stub.c: In function 'exit_boot_func':
drivers/firmware/efi/libstub/x86-stub.c:641:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
efi_set_u64_split((u64)efi_system_table,
^
drivers/firmware/efi/libstub/x86-stub.c:645:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
efi_set_u64_split((u64)*map->map,
^

vim +411 drivers/firmware/efi/libstub/x86-stub.c

343
344 void __noreturn efi_stub_entry(efi_handle_t handle,
345 efi_system_table_t *sys_table_arg,
346 struct boot_params *boot_params);
347
348 /*
349 * Because the x86 boot code expects to be passed a boot_params we
350 * need to create one ourselves (usually the bootloader would create
351 * one for us).
352 */
353 efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
354 efi_system_table_t *sys_table_arg)
355 {
356 struct boot_params *boot_params;
357 struct setup_header *hdr;
358 efi_loaded_image_t *image;
359 void *image_base;
360 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
361 int options_size = 0;
362 efi_status_t status;
363 char *cmdline_ptr;
364 unsigned long ramdisk_addr;
365 unsigned long ramdisk_size;
366
367 efi_system_table = sys_table_arg;
368
369 /* Check if we were booted by the EFI firmware */
370 if (efi_system_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
371 efi_exit(handle, EFI_INVALID_PARAMETER);
372
373 status = efi_bs_call(handle_protocol, handle, &proto, (void **)&image);
374 if (status != EFI_SUCCESS) {
375 efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
376 efi_exit(handle, status);
377 }
378
379 image_base = efi_table_attr(image, image_base);
380 image_offset = (void *)startup_32 - image_base;
381
382 status = efi_allocate_pages(sizeof(struct boot_params),
383 (unsigned long *)&boot_params, ULONG_MAX);
384 if (status != EFI_SUCCESS) {
385 efi_printk("Failed to allocate lowmem for boot params\n");
386 efi_exit(handle, status);
387 }
388
389 memset(boot_params, 0x0, sizeof(struct boot_params));
390
391 hdr = &boot_params->hdr;
392
393 /* Copy the second sector to boot_params */
394 memcpy(&hdr->jump, image_base + 512, 512);
395
396 /*
397 * Fill out some of the header fields ourselves because the
398 * EFI firmware loader doesn't load the first sector.
399 */
400 hdr->root_flags = 1;
401 hdr->vid_mode = 0xffff;
402 hdr->boot_flag = 0xAA55;
403
404 hdr->type_of_loader = 0x21;
405
406 /* Convert unicode cmdline to ascii */
407 cmdline_ptr = efi_convert_cmdline(image, &options_size, ULONG_MAX);
408 if (!cmdline_ptr)
409 goto fail;
410
> 411 efi_set_u64_split((u64)cmdline_ptr,
412 &hdr->cmd_line_ptr, &boot_params->ext_cmd_line_ptr);
413
414 hdr->ramdisk_image = 0;
415 hdr->ramdisk_size = 0;
416
417 if (efi_is_native()) {
418 status = efi_parse_options(cmdline_ptr);
419 if (status != EFI_SUCCESS)
420 goto fail2;
421
422 if (!efi_noinitrd) {
423 status = efi_load_initrd(image, &ramdisk_addr,
424 &ramdisk_size,
425 hdr->initrd_addr_max,
426 ULONG_MAX);
427 if (status != EFI_SUCCESS)
428 goto fail2;
429 efi_set_u64_split(ramdisk_addr, &hdr->ramdisk_image,
430 &boot_params->ext_ramdisk_image);
431 efi_set_u64_split(ramdisk_size, &hdr->ramdisk_size,
432 &boot_params->ext_ramdisk_size);
433 }
434 }
435
436 efi_stub_entry(handle, sys_table_arg, boot_params);
437 /* not reached */
438
439 fail2:
440 efi_free(options_size, (unsigned long)cmdline_ptr);
441 fail:
442 efi_free(sizeof(struct boot_params), (unsigned long)boot_params);
443
444 efi_exit(handle, status);
445 }
446

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip