All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call
@ 2024-10-30 20:16 Moritz Fischer
  2024-10-30 20:28 ` Ilias Apalodimas
  2024-10-30 20:29 ` Heinrich Schuchardt
  0 siblings, 2 replies; 4+ messages in thread
From: Moritz Fischer @ 2024-10-30 20:16 UTC (permalink / raw)
  To: u-boot; +Cc: xypron.glpk, ilias.apalodimas, trini, pwildt, Moritz Fischer

The function expects an end address but is being called with
an size instead.

Fixes: 6422820ac3 ("efi_loader: split unrelated code from efi_bootmgr.c")
Signed-off-by: Moritz Fischer <moritzf@google.com>
---
 lib/efi_loader/efi_bootbin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
index a87006b3c0..798bcd6eee 100644
--- a/lib/efi_loader/efi_bootbin.c
+++ b/lib/efi_loader/efi_bootbin.c
@@ -137,7 +137,8 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
 		 */
 		file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
 					    (uintptr_t)source_buffer,
-					    source_size);
+					    (uintptr_t)source_buffer +
+					    (size_t)source_size);
 		/*
 		 * Make sure that device for device_path exist
 		 * in load_image(). Otherwise, shell and grub will fail.
-- 
2.47.0.163.g1226f6d8fa-goog


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

* Re: [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call
  2024-10-30 20:16 [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call Moritz Fischer
@ 2024-10-30 20:28 ` Ilias Apalodimas
  2024-10-30 20:59   ` Moritz Fischer
  2024-10-30 20:29 ` Heinrich Schuchardt
  1 sibling, 1 reply; 4+ messages in thread
From: Ilias Apalodimas @ 2024-10-30 20:28 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: u-boot, xypron.glpk, trini, pwildt

Hi Moritz

Thanks for the patch

On Wed, 30 Oct 2024 at 22:16, Moritz Fischer <moritzf@google.com> wrote:
>
> The function expects an end address but is being called with
> an size instead.
>
> Fixes: 6422820ac3 ("efi_loader: split unrelated code from efi_bootmgr.c")
> Signed-off-by: Moritz Fischer <moritzf@google.com>
> ---
>  lib/efi_loader/efi_bootbin.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
> index a87006b3c0..798bcd6eee 100644
> --- a/lib/efi_loader/efi_bootbin.c
> +++ b/lib/efi_loader/efi_bootbin.c
> @@ -137,7 +137,8 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
>                  */
>                 file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
>                                             (uintptr_t)source_buffer,
> -                                           source_size);
> +                                           (uintptr_t)source_buffer +
> +                                           (size_t)source_size);

Yes, the change is correct, but we don't need the cast.

With that changed
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


>                 /*
>                  * Make sure that device for device_path exist
>                  * in load_image(). Otherwise, shell and grub will fail.
> --
> 2.47.0.163.g1226f6d8fa-goog
>

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

* Re: [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call
  2024-10-30 20:16 [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call Moritz Fischer
  2024-10-30 20:28 ` Ilias Apalodimas
@ 2024-10-30 20:29 ` Heinrich Schuchardt
  1 sibling, 0 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2024-10-30 20:29 UTC (permalink / raw)
  To: Moritz Fischer, u-boot; +Cc: ilias.apalodimas, trini, pwildt

On 10/30/24 21:16, Moritz Fischer wrote:
> The function expects an end address but is being called with
> an size instead.
>
> Fixes: 6422820ac3 ("efi_loader: split unrelated code from efi_bootmgr.c")
> Signed-off-by: Moritz Fischer <moritzf@google.com>
> ---
>   lib/efi_loader/efi_bootbin.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
> index a87006b3c0..798bcd6eee 100644
> --- a/lib/efi_loader/efi_bootbin.c
> +++ b/lib/efi_loader/efi_bootbin.c
> @@ -137,7 +137,8 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
>   		 */
>   		file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
>   					    (uintptr_t)source_buffer,
> -					    source_size);
> +					    (uintptr_t)source_buffer +
> +					    (size_t)source_size);
>   		/*
>   		 * Make sure that device for device_path exist
>   		 * in load_image(). Otherwise, shell and grub will fail.


The  efi_dp_from_mem() invocation in  efi_dp_from_name() seems also to
be affected.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

* Re: [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call
  2024-10-30 20:28 ` Ilias Apalodimas
@ 2024-10-30 20:59   ` Moritz Fischer
  0 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2024-10-30 20:59 UTC (permalink / raw)
  To: Ilias Apalodimas; +Cc: u-boot, xypron.glpk, trini, pwildt

On Wed, Oct 30, 2024 at 10:28:40PM GMT, Ilias Apalodimas wrote:
> Hi Moritz

> Thanks for the patch

> On Wed, 30 Oct 2024 at 22:16, Moritz Fischer <moritzf@google.com> wrote:
> >
> > The function expects an end address but is being called with
> > an size instead.
> >
> > Fixes: 6422820ac3 ("efi_loader: split unrelated code from  
> efi_bootmgr.c")
> > Signed-off-by: Moritz Fischer <moritzf@google.com>
> > ---
> >  lib/efi_loader/efi_bootbin.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/efi_loader/efi_bootbin.c b/lib/efi_loader/efi_bootbin.c
> > index a87006b3c0..798bcd6eee 100644
> > --- a/lib/efi_loader/efi_bootbin.c
> > +++ b/lib/efi_loader/efi_bootbin.c
> > @@ -137,7 +137,8 @@ efi_status_t efi_run_image(void *source_buffer,  
> efi_uintn_t source_size)
> >                  */
> >                 file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
> >                                             (uintptr_t)source_buffer,
> > -                                           source_size);
> > +                                           (uintptr_t)source_buffer +
> > +                                           (size_t)source_size);

> Yes, the change is correct, but we don't need the cast.

> With that changed
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Ack. Will send a v2.


> >                 /*
> >                  * Make sure that device for device_path exist
> >                  * in load_image(). Otherwise, shell and grub will fail.
> > --
> > 2.47.0.163.g1226f6d8fa-goog
> >

Thanks,
Moritz

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

end of thread, other threads:[~2024-10-30 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 20:16 [PATCH] lib: efi_loader: Fix efi_dp_from_mem() call Moritz Fischer
2024-10-30 20:28 ` Ilias Apalodimas
2024-10-30 20:59   ` Moritz Fischer
2024-10-30 20:29 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.