Instead of copying a GUID and then using a pointer to the copy for calling
guidcmp(), just pass the pointer to the orginal GUID.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
 cmd/efidebug.c                   | 2 +-
 include/efi_loader.h             | 3 ++-
 lib/efi_loader/efi_device_path.c | 5 +++--
 lib/efi_loader/efi_helper.c      | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 67ab06aefc..5235dbb7c1 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1169,7 +1169,7 @@ static void show_efi_boot_opt_data(u16 *varname16, void 
*data, size_t *size)
        printf("  file_path: %ls\n", dp_str);
        efi_free_pool(dp_str);

-       initrd_path = efi_dp_from_lo(&lo, &initrd_dp_size, lf2_initrd_guid);
+       initrd_path = efi_dp_from_lo(&lo, &initrd_dp_size, &lf2_initrd_guid);
        if (initrd_path) {
                dp_str = efi_dp_str(initrd_path);
                printf("  initrd_path: %ls\n", dp_str);
diff --git a/include/efi_loader.h b/include/efi_loader.h
index c440962fe5..8b57bb9b09 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -840,7 +840,8 @@ struct efi_load_option {
 };

 struct efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
-                                      efi_uintn_t *size, efi_guid_t guid);
+                                      efi_uintn_t *size,
+                                      const efi_guid_t *guid);
 struct efi_device_path *efi_dp_concat(const struct efi_device_path *dp1,
                                      const struct efi_device_path *dp2);
 efi_status_t efi_deserialize_load_option(struct efi_load_option *lo, u8 *data,
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index cbdb466da4..c3139f8e64 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -1272,7 +1272,8 @@ ssize_t efi_dp_check_length(const struct efi_device_path 
*dp,
  */
 struct
 efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
-                               efi_uintn_t *size, efi_guid_t guid)
+                               efi_uintn_t *size,
+                               const efi_guid_t *guid)
 {
        struct efi_device_path *fp = lo->file_path;
        struct efi_device_path_vendor *vendor;
@@ -1287,7 +1288,7 @@ efi_device_path *efi_dp_from_lo(struct efi_load_option 
*lo,
                        continue;

                vendor = (struct efi_device_path_vendor *)fp;
-               if (!guidcmp(&vendor->guid, &guid))
+               if (!guidcmp(&vendor->guid, guid))
                        return efi_dp_dup(fp);
        }
        log_debug("VenMedia(%pUl) not found in %ls\n", &guid, lo->label);
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index d03a736461..4c5b7cd2e1 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -83,7 +83,7 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t 
guid)
        if (ret != EFI_SUCCESS)
                goto out;

-       tmp = efi_dp_from_lo(&lo, &size, guid);
+       tmp = efi_dp_from_lo(&lo, &size, &guid);
        if (!tmp)
                goto out;

--
2.30.2

Reply via email to