public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found
@ 2017-08-06 16:23 Rob Clark
  2017-08-06 17:27 ` Heinrich Schuchardt
  2017-08-06 18:40 ` Mark Kettenis
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Clark @ 2017-08-06 16:23 UTC (permalink / raw)
  To: u-boot

Spotted this debugging OpenBSD's bootloader in qemu.  (Wouldn't really
fix anything, the problem was not having any disks, but we should
probably return the correct error code.)

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

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 5ff2d2d4b0..ada119325c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -643,6 +643,9 @@ static efi_status_t EFIAPI efi_locate_handle(
 	}
 
 	*buffer_size = size;
+	if (size == 0)
+		return EFI_NOT_FOUND;
+
 	return EFI_SUCCESS;
 }
 
-- 
2.13.0

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

* [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found
  2017-08-06 16:23 [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found Rob Clark
@ 2017-08-06 17:27 ` Heinrich Schuchardt
  2017-08-06 18:40 ` Mark Kettenis
  1 sibling, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2017-08-06 17:27 UTC (permalink / raw)
  To: u-boot

On 08/06/2017 06:23 PM, Rob Clark wrote:
> Spotted this debugging OpenBSD's bootloader in qemu.  (Wouldn't really
> fix anything, the problem was not having any disks, but we should
> probably return the correct error code.)
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  lib/efi_loader/efi_boottime.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 5ff2d2d4b0..ada119325c 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -643,6 +643,9 @@ static efi_status_t EFIAPI efi_locate_handle(
>  	}
>  
>  	*buffer_size = size;
> +	if (size == 0)
> +		return EFI_NOT_FOUND;
> +
>  	return EFI_SUCCESS;
>  }
>  
> 

Thanks for spotting this.

We can do the test earlier, if we move
	*buffer_size = size;
to another line.

test:

...
                        size += sizeof(void*);
                }
        }

        if (*buffer_size < size) {
	        *buffer_size = size;
                return EFI_BUFFER_TOO_SMALL;
	}
        *buffer_size = size;
	if (size == 0)
		return EFI_NOT_FOUND;

        /* Then fill the array */
...

Best regards

Heinrich

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

* [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found
  2017-08-06 16:23 [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found Rob Clark
  2017-08-06 17:27 ` Heinrich Schuchardt
@ 2017-08-06 18:40 ` Mark Kettenis
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2017-08-06 18:40 UTC (permalink / raw)
  To: u-boot

> From: Rob Clark <robdclark@gmail.com>
> Date: Sun,  6 Aug 2017 12:23:50 -0400
> 
> Spotted this debugging OpenBSD's bootloader in qemu.  (Wouldn't really
> fix anything, the problem was not having any disks, but we should
> probably return the correct error code.)
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>

> ---
>  lib/efi_loader/efi_boottime.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 5ff2d2d4b0..ada119325c 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -643,6 +643,9 @@ static efi_status_t EFIAPI efi_locate_handle(
>  	}
>  
>  	*buffer_size = size;
> +	if (size == 0)
> +		return EFI_NOT_FOUND;
> +
>  	return EFI_SUCCESS;
>  }
>  
> -- 
> 2.13.0
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
> 
> 

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

end of thread, other threads:[~2017-08-06 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-06 16:23 [U-Boot] [PATCH] efi_loader: LocateHandle should return EFI_NOT_FOUND if none found Rob Clark
2017-08-06 17:27 ` Heinrich Schuchardt
2017-08-06 18:40 ` Mark Kettenis

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