diff options
author | Tom Rini <trini@konsulko.com> | 2020-06-03 14:10:03 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-06-03 14:10:03 -0400 |
commit | 1b6ae82a5abb4cbedb0d6cb262526173f4efa486 (patch) | |
tree | 916aadd700c3c98d3f6b6929ef1249e38043e319 /cmd | |
parent | 0d8f35b58cc8458a5263b424896a386429ee49e5 (diff) | |
parent | a4292eccfdc98b51d0200a6c912af237aeddd5c8 (diff) |
Merge tag 'efi-2020-07-rc4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2020-07-rc4
This patch series addresses the following issues:
* allow compiling with clang
* add missing function descriptions to the HTML documentation
* simplify the validation of UEFI images
* validate load options in the UEFI boot manager
In a preparatory patch a structure definition is moved.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/efidebug.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 32430e62f0a..58018f700cd 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -694,14 +694,19 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag, * * Decode the value of UEFI load option variable and print information. */ -static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t size) +static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size) { struct efi_load_option lo; char *label, *p; size_t label_len16, label_len; u16 *dp_str; + efi_status_t ret; - efi_deserialize_load_option(&lo, data); + ret = efi_deserialize_load_option(&lo, data, size); + if (ret != EFI_SUCCESS) { + printf("%ls: invalid load option\n", varname16); + return; + } label_len16 = u16_strlen(lo.label); label_len = utf16_utf8_strnlen(lo.label, label_len16); @@ -728,8 +733,7 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t size) printf(" data:\n"); print_hex_dump(" ", DUMP_PREFIX_OFFSET, 16, 1, - lo.optional_data, size + (u8 *)data - - (u8 *)lo.optional_data, true); + lo.optional_data, *size, true); free(label); } @@ -759,7 +763,7 @@ static void show_efi_boot_opt(u16 *varname16) &efi_global_variable_guid, NULL, &size, data)); if (ret == EFI_SUCCESS) - show_efi_boot_opt_data(varname16, data, size); + show_efi_boot_opt_data(varname16, data, &size); free(data); } } @@ -920,7 +924,12 @@ static int show_efi_boot_order(void) goto out; } - efi_deserialize_load_option(&lo, data); + ret = efi_deserialize_load_option(&lo, data, &size); + if (ret != EFI_SUCCESS) { + printf("%ls: invalid load option\n", var_name16); + ret = CMD_RET_FAILURE; + goto out; + } label_len16 = u16_strlen(lo.label); label_len = utf16_utf8_strnlen(lo.label, label_len16); |