diff options
author | Tom Rini <trini@konsulko.com> | 2022-12-20 12:50:38 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-12-20 12:50:48 -0500 |
commit | 1154e965d0bd16cf438afdaa4118e1455fd71a44 (patch) | |
tree | 9d862e44a520ea50e1cb8b15fd1ffd5675c5a018 /lib/efi_loader/efi_helper.c | |
parent | 566bc672a7474f4bf67b29514121ed41db21ed71 (diff) | |
parent | ad50ca5019ae2b4f6ad5ffb4d62808b640f7b8aa (diff) |
Merge tag 'efi-2023-01-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-01-rc5
UEFI:
* Improve parameter checking in efi_get_next_variable_name_mem()
* Fix a bugs in management of security database via the eficonfig command
Other:
* Allow sound command to play multiple sounds
Diffstat (limited to 'lib/efi_loader/efi_helper.c')
-rw-r--r-- | lib/efi_loader/efi_helper.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 788cb9faec..1f4ab2b419 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -223,3 +223,37 @@ bool efi_varname_is_load_option(u16 *var_name16, int *index) return false; } + +/** + * efi_next_variable_name() - get next variable name + * + * This function is a wrapper of efi_get_next_variable_name_int(). + * If efi_get_next_variable_name_int() returns EFI_BUFFER_TOO_SMALL, + * @size and @buf are updated by new buffer size and realloced buffer. + * + * @size: pointer to the buffer size + * @buf: pointer to the buffer + * @guid: pointer to the guid + * Return: status code + */ +efi_status_t efi_next_variable_name(efi_uintn_t *size, u16 **buf, efi_guid_t *guid) +{ + u16 *p; + efi_status_t ret; + efi_uintn_t buf_size = *size; + + ret = efi_get_next_variable_name_int(&buf_size, *buf, guid); + if (ret == EFI_NOT_FOUND) + return ret; + if (ret == EFI_BUFFER_TOO_SMALL) { + p = realloc(*buf, buf_size); + if (!p) + return EFI_OUT_OF_RESOURCES; + + *buf = p; + *size = buf_size; + ret = efi_get_next_variable_name_int(&buf_size, *buf, guid); + } + + return ret; +} |