efi_loader: pass GUID by address to efi_dp_from_lo

We should not pass GUIDs by value as this requires copying.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Heinrich Schuchardt
2024-04-26 16:13:08 +02:00
parent b319356238
commit 8745f13fe1
3 changed files with 4 additions and 4 deletions

View File

@@ -743,7 +743,7 @@ efi_status_t EFIAPI efi_register_protocol_notify(const efi_guid_t *protocol,
efi_status_t efi_file_size(struct efi_file_handle *fh, efi_uintn_t *size); efi_status_t efi_file_size(struct efi_file_handle *fh, efi_uintn_t *size);
/* get a device path from a Boot#### option */ /* get a device path from a Boot#### option */
struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid); struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid);
/* get len, string (used in u-boot crypto from a guid */ /* get len, string (used in u-boot crypto from a guid */
const char *guid_to_sha_str(const efi_guid_t *guid); const char *guid_to_sha_str(const efi_guid_t *guid);

View File

@@ -72,7 +72,7 @@ out:
* *
* Return: device path or NULL. Caller must free the returned value * Return: device path or NULL. Caller must free the returned value
*/ */
struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid) struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t *guid)
{ {
struct efi_load_option lo; struct efi_load_option lo;
void *var_value; void *var_value;
@@ -92,7 +92,7 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid)
if (ret != EFI_SUCCESS) if (ret != EFI_SUCCESS)
goto err; goto err;
return efi_dp_from_lo(&lo, &guid); return efi_dp_from_lo(&lo, guid);
err: err:
free(var_value); free(var_value);

View File

@@ -63,7 +63,7 @@ static efi_status_t get_initrd_fp(struct efi_device_path **initrd_fp)
* We can then use this specific return value and not install the * We can then use this specific return value and not install the
* protocol, while allowing the boot to continue * protocol, while allowing the boot to continue
*/ */
dp = efi_get_dp_from_boot(efi_lf2_initrd_guid); dp = efi_get_dp_from_boot(&efi_lf2_initrd_guid);
if (!dp) if (!dp)
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;