Skip to contentSkip to conversation

efi_loader: LocateHandle should return EFI_NOT_FOUND if none found

PATCH Superseded Rob Clark 3 participants 3 messages Aug 6, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 efi_loader: LocateHandle should return EFI_NOT_FOUND if none found

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.)

---
 lib/efi_loader/efi_boottime.c | 3 +++
 1 file changed, 3 insertions(+)
lib/efi_loader/efi_boottime.c +3 -0
index 5ff2d2d4b0..ada119325c 100644
@@ -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;
 }
 
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/1 efi_loader: LocateHandle should return EFI_NOT_FOUND if none found

Quoted 15 lines · Rob Clark

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.)

---
 lib/efi_loader/efi_boottime.c | 3 +++
 1 file changed, 3 insertions(+)
lib/efi_loader/efi_boottime.c +0 -0
index 5ff2d2d4b0..ada119325c 100644

lib/efi_loader/efi_boottime.c static efi_status_t EFIAPI efi_locate_handle( · line 651

Quoted 9 lines
lib/efi_loader/efi_boottime.c +3 -0
@@ -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

#2 lore raw

PATCH 1/1 efi_loader: LocateHandle should return EFI_NOT_FOUND if none found

In reply to Rob Clark
Quoted 8 lines

From: Rob Clark <[email protected]>
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.)

Quoted 27 lines
---
 lib/efi_loader/efi_boottime.c | 3 +++
 1 file changed, 3 insertions(+)
lib/efi_loader/efi_boottime.c +3 -0
index 5ff2d2d4b0..ada119325c 100644
@@ -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;
 }
 
Signature · 6 lines
2.13.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot