summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_path.c
diff options
context:
space:
mode:
authorMichael Brown2022-12-22 14:28:06 +0100
committerMichael Brown2022-12-22 14:30:02 +0100
commit0f3ace92c6f7bd60a6688c0bacfa5aeacfdb5b73 (patch)
treea46994764981346594cd01d8347761327fc5a847 /src/interface/efi/efi_path.c
parent[efi] Provide VLAN configuration protocol (diff)
downloadipxe-0f3ace92c6f7bd60a6688c0bacfa5aeacfdb5b73.tar.gz
ipxe-0f3ace92c6f7bd60a6688c0bacfa5aeacfdb5b73.tar.xz
ipxe-0f3ace92c6f7bd60a6688c0bacfa5aeacfdb5b73.zip
[efi] Allow passing a NULL device path to path utility functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_path.c')
-rw-r--r--src/interface/efi/efi_path.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/interface/efi/efi_path.c b/src/interface/efi/efi_path.c
index bae0ac4b..1a95a3b9 100644
--- a/src/interface/efi/efi_path.c
+++ b/src/interface/efi/efi_path.c
@@ -43,12 +43,12 @@
/**
* Find end of device path
*
- * @v path Path to device
- * @ret path_end End of device path
+ * @v path Device path, or NULL
+ * @ret path_end End of device path, or NULL
*/
EFI_DEVICE_PATH_PROTOCOL * efi_path_end ( EFI_DEVICE_PATH_PROTOCOL *path ) {
- while ( path->Type != END_DEVICE_PATH_TYPE ) {
+ while ( path && ( path->Type != END_DEVICE_PATH_TYPE ) ) {
path = ( ( ( void * ) path ) +
/* There's this amazing new-fangled thing known as
* a UINT16, but who wants to use one of those? */
@@ -61,7 +61,7 @@ EFI_DEVICE_PATH_PROTOCOL * efi_path_end ( EFI_DEVICE_PATH_PROTOCOL *path ) {
/**
* Find length of device path (excluding terminator)
*
- * @v path Path to device
+ * @v path Device path, or NULL
* @ret path_len Length of device path
*/
size_t efi_path_len ( EFI_DEVICE_PATH_PROTOCOL *path ) {