Re: [bug report] efi/libstub: Unify initrd loading across architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 3 Jun 2020 at 12:05, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> Hello Arvind Sankar,
>
> The patch f61900fd0ebf: "efi/libstub: Unify initrd loading across
> architectures" from Apr 30, 2020, leads to the following static
> checker warning:
>
>         drivers/firmware/efi/libstub/efi-stub-helper.c:481 efi_load_initrd_cmdline()
>         error: we previously assumed 'image' could be null (see line 474)
>
> drivers/firmware/efi/libstub/efi-stub-helper.c
>    466  static
>    467  efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
>    468                                       unsigned long *load_addr,
>    469                                       unsigned long *load_size,
>    470                                       unsigned long soft_limit,
>    471                                       unsigned long hard_limit)
>    472  {
>    473          if (!IS_ENABLED(CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER) ||
>    474              (IS_ENABLED(CONFIG_X86) && (!efi_is_native() || image == NULL))) {
>                      ^^^^^^^^^^^^^^^^^^^^^^                         ^^^^^^^^^^^^^
> Assume X86 is not configured but "image" is NULL.
>
>    475                  *load_addr = *load_size = 0;
>    476                  return EFI_SUCCESS;
>    477          }
>    478
>    479          return handle_cmdline_files(image, L"initrd=", sizeof(L"initrd=") - 2,
>                                             ^^^^^
> Dereferenced inside the function.

image is guaranteed to be non-null on !x86 architectures.

>
>    480                                      soft_limit, hard_limit,
>    481                                      load_addr, load_size);
>    482  }
>
> regards,
> dan carpenter



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux