public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map
@ 2017-07-26 18:34 Rob Clark
  2017-07-26 20:10 ` Alexander Graf
  2017-07-28 22:27 ` [U-Boot] " Alexander Graf
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Clark @ 2017-07-26 18:34 UTC (permalink / raw)
  To: u-boot

When booting shim -> fallback -> shim -> grub -> linux the memory map is
a bit larger than the size linux passes in on the first call.  But in
the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size
to linux so it would loop forever.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 lib/efi_loader/efi_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index f59e3ea327..9e079f1fa3 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -407,11 +407,11 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
 
 	map_size = map_entries * sizeof(struct efi_mem_desc);
 
+	*memory_map_size = map_size;
+
 	if (provided_map_size < map_size)
 		return EFI_BUFFER_TOO_SMALL;
 
-	*memory_map_size = map_size;
-
 	if (descriptor_size)
 		*descriptor_size = sizeof(struct efi_mem_desc);
 
-- 
2.13.0

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

* [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map
  2017-07-26 18:34 [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map Rob Clark
@ 2017-07-26 20:10 ` Alexander Graf
  2017-07-26 20:25   ` Rob Clark
  2017-07-28 22:27 ` [U-Boot] " Alexander Graf
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2017-07-26 20:10 UTC (permalink / raw)
  To: u-boot



On 26.07.17 20:34, Rob Clark wrote:
> When booting shim -> fallback -> shim -> grub -> linux the memory map is
> a bit larger than the size linux passes in on the first call.  But in
> the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size
> to linux so it would loop forever.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

The spec is actually very explicit about this case. It says in the 
EFI_BUFFER_TOO_SMALL case, we *have* to return the map size.


Alex

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

* [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map
  2017-07-26 20:10 ` Alexander Graf
@ 2017-07-26 20:25   ` Rob Clark
  2017-07-27 14:44     ` Brüns, Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Clark @ 2017-07-26 20:25 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 26, 2017 at 4:10 PM, Alexander Graf <agraf@suse.de> wrote:
>
>
> On 26.07.17 20:34, Rob Clark wrote:
>>
>> When booting shim -> fallback -> shim -> grub -> linux the memory map is
>> a bit larger than the size linux passes in on the first call.  But in
>> the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size
>> to linux so it would loop forever.
>>
>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>
>
> The spec is actually very explicit about this case. It says in the
> EFI_BUFFER_TOO_SMALL case, we *have* to return the map size.
>

yes, that is what I fixed.  We *weren't* returning the required buffer
size before :-)

BR,
-R

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

* [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map
  2017-07-26 20:25   ` Rob Clark
@ 2017-07-27 14:44     ` Brüns, Stefan
  0 siblings, 0 replies; 5+ messages in thread
From: Brüns, Stefan @ 2017-07-27 14:44 UTC (permalink / raw)
  To: u-boot

On Mittwoch, 26. Juli 2017 22:25:29 CEST Rob Clark wrote:
> On Wed, Jul 26, 2017 at 4:10 PM, Alexander Graf <agraf@suse.de> wrote:
> > On 26.07.17 20:34, Rob Clark wrote:
> >> When booting shim -> fallback -> shim -> grub -> linux the memory map is
> >> a bit larger than the size linux passes in on the first call.  But in
> >> the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size
> >> to linux so it would loop forever.
> >> 
> >> Signed-off-by: Rob Clark <robdclark@gmail.com>
> > 
> > The spec is actually very explicit about this case. It says in the
> > EFI_BUFFER_TOO_SMALL case, we *have* to return the map size.
> 
> yes, that is what I fixed.  We *weren't* returning the required buffer
> size before :-)

Sigh, yes, this was correct in the first 3 versions of the patch series, but 
unfortunately broken in v4 which was actually committed ...

See: https://lists.denx.de/pipermail/u-boot/2016-October/268766.html

Actually, the map_size variable is no longer needed, if you assign to 
*memory_map_size directly.

Anyway, this patch is:
Reviewed-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>

Kind regards,

Stefan

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

* [U-Boot] efi_loader: fix bug in efi_get_memory_map
  2017-07-26 18:34 [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map Rob Clark
  2017-07-26 20:10 ` Alexander Graf
@ 2017-07-28 22:27 ` Alexander Graf
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2017-07-28 22:27 UTC (permalink / raw)
  To: u-boot

> When booting shim -> fallback -> shim -> grub -> linux the memory map is
> a bit larger than the size linux passes in on the first call.  But in
> the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size
> to linux so it would loop forever.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Thanks, applied to efi-next

Alex

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

end of thread, other threads:[~2017-07-28 22:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-26 18:34 [U-Boot] [PATCH] efi_loader: fix bug in efi_get_memory_map Rob Clark
2017-07-26 20:10 ` Alexander Graf
2017-07-26 20:25   ` Rob Clark
2017-07-27 14:44     ` Brüns, Stefan
2017-07-28 22:27 ` [U-Boot] " Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox