tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git urgent head: 86237b46f2b202331c07e4c6c2633ce3d3ba7f13 commit: 86237b46f2b202331c07e4c6c2633ce3d3ba7f13 [12/12] efi: libstub: Look for initrd LoadFile2 protocol on image handle config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20230318/202303180724.UexnVEeA-lkp@xxxxxxxxx/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Reported-by: Dan Carpenter <error27@xxxxxxxxx> | Link: https://lore.kernel.org/r/202303180724.UexnVEeA-lkp@xxxxxxxxx/ smatch warnings: drivers/firmware/efi/libstub/efi-stub-helper.c:528 efi_load_initrd_lf2() error: uninitialized symbol 'dp'. vim +/dp +528 drivers/firmware/efi/libstub/efi-stub-helper.c f61900fd0ebf6c Arvind Sankar 2020-04-30 498 static 86237b46f2b202 Ard Biesheuvel 2023-03-10 499 efi_status_t efi_load_initrd_lf2(efi_handle_t image_handle, 86237b46f2b202 Ard Biesheuvel 2023-03-10 500 struct linux_efi_initrd *initrd, ec93fc371f014a Ard Biesheuvel 2020-02-03 501 unsigned long max) ec93fc371f014a Ard Biesheuvel 2020-02-03 502 { ec93fc371f014a Ard Biesheuvel 2020-02-03 503 efi_guid_t lf2_proto_guid = EFI_LOAD_FILE2_PROTOCOL_GUID; 86237b46f2b202 Ard Biesheuvel 2023-03-10 504 efi_guid_t initrd_lf2_proto_guid = LINUX_EFI_INITRD_LF2_PROTOCOL_GUID; ec93fc371f014a Ard Biesheuvel 2020-02-03 505 efi_device_path_protocol_t *dp; ec93fc371f014a Ard Biesheuvel 2020-02-03 506 efi_load_file2_protocol_t *lf2; ec93fc371f014a Ard Biesheuvel 2020-02-03 507 efi_handle_t handle; ec93fc371f014a Ard Biesheuvel 2020-02-03 508 efi_status_t status; ec93fc371f014a Ard Biesheuvel 2020-02-03 509 86237b46f2b202 Ard Biesheuvel 2023-03-10 510 /* first look for a initrd loading protocol specific to this image */ 86237b46f2b202 Ard Biesheuvel 2023-03-10 511 status = efi_bs_call(handle_protocol, image_handle, &initrd_lf2_proto_guid, 86237b46f2b202 Ard Biesheuvel 2023-03-10 512 (void **)&lf2); 86237b46f2b202 Ard Biesheuvel 2023-03-10 513 if (status != EFI_SUCCESS) { 86237b46f2b202 Ard Biesheuvel 2023-03-10 514 /* look for the global singleton initrd loading protocol */ ec93fc371f014a Ard Biesheuvel 2020-02-03 515 dp = (efi_device_path_protocol_t *)&initrd_dev_path; 86237b46f2b202 Ard Biesheuvel 2023-03-10 516 status = efi_bs_call(locate_device_path, &lf2_proto_guid, &dp, 86237b46f2b202 Ard Biesheuvel 2023-03-10 517 &handle); ec93fc371f014a Ard Biesheuvel 2020-02-03 518 if (status != EFI_SUCCESS) ec93fc371f014a Ard Biesheuvel 2020-02-03 519 return status; ec93fc371f014a Ard Biesheuvel 2020-02-03 520 ec93fc371f014a Ard Biesheuvel 2020-02-03 521 status = efi_bs_call(handle_protocol, handle, &lf2_proto_guid, ec93fc371f014a Ard Biesheuvel 2020-02-03 522 (void **)&lf2); ec93fc371f014a Ard Biesheuvel 2020-02-03 523 if (status != EFI_SUCCESS) ec93fc371f014a Ard Biesheuvel 2020-02-03 524 return status; 86237b46f2b202 Ard Biesheuvel 2023-03-10 525 } dp not initialized on else path. ec93fc371f014a Ard Biesheuvel 2020-02-03 526 f4dc7fffa9873d Ard Biesheuvel 2022-09-16 527 initrd->size = 0; f4dc7fffa9873d Ard Biesheuvel 2022-09-16 @528 status = efi_call_proto(lf2, load_file, dp, false, &initrd->size, NULL); ^^ Uninitialized. ec93fc371f014a Ard Biesheuvel 2020-02-03 529 if (status != EFI_BUFFER_TOO_SMALL) ec93fc371f014a Ard Biesheuvel 2020-02-03 530 return EFI_LOAD_ERROR; ec93fc371f014a Ard Biesheuvel 2020-02-03 531 f4dc7fffa9873d Ard Biesheuvel 2022-09-16 532 status = efi_allocate_pages(initrd->size, &initrd->base, max); ec93fc371f014a Ard Biesheuvel 2020-02-03 533 if (status != EFI_SUCCESS) ec93fc371f014a Ard Biesheuvel 2020-02-03 534 return status; ec93fc371f014a Ard Biesheuvel 2020-02-03 535 f4dc7fffa9873d Ard Biesheuvel 2022-09-16 536 status = efi_call_proto(lf2, load_file, dp, false, &initrd->size, f4dc7fffa9873d Ard Biesheuvel 2022-09-16 537 (void *)initrd->base); ec93fc371f014a Ard Biesheuvel 2020-02-03 538 if (status != EFI_SUCCESS) { f4dc7fffa9873d Ard Biesheuvel 2022-09-16 539 efi_free(initrd->size, initrd->base); ec93fc371f014a Ard Biesheuvel 2020-02-03 540 return EFI_LOAD_ERROR; ec93fc371f014a Ard Biesheuvel 2020-02-03 541 } ec93fc371f014a Ard Biesheuvel 2020-02-03 542 return EFI_SUCCESS; ec93fc371f014a Ard Biesheuvel 2020-02-03 543 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests