linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] efi/libstub: Unify initrd loading across architectures
@ 2020-06-03 10:05 Dan Carpenter
  2020-06-03 10:26 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-06-03 10:05 UTC (permalink / raw)
  To: nivedita; +Cc: linux-efi

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.

   480                                      soft_limit, hard_limit,
   481                                      load_addr, load_size);
   482  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] efi/libstub: Unify initrd loading across architectures
  2020-06-03 10:05 [bug report] efi/libstub: Unify initrd loading across architectures Dan Carpenter
@ 2020-06-03 10:26 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2020-06-03 10:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Arvind Sankar, linux-efi

On Wed, 3 Jun 2020 at 12:05, Dan Carpenter <dan.carpenter@oracle.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 10:05 [bug report] efi/libstub: Unify initrd loading across architectures Dan Carpenter
2020-06-03 10:26 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).