diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/Kconfig | 1 | ||||
-rw-r--r-- | cmd/efidebug.c | 21 | ||||
-rw-r--r-- | cmd/fitupd.c | 4 | ||||
-rw-r--r-- | cmd/sf.c | 3 |
4 files changed, 16 insertions, 13 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 153864c587..192b3b262f 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -491,6 +491,7 @@ config CMD_SPL_WRITE_SIZE config CMD_FITUPD bool "fitImage update command" + depends on UPDATE_TFTP help Implements the 'fitupd' command, which allows to automatically store software updates present on a TFTP server in NOR Flash diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 32430e62f0..58018f700c 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); diff --git a/cmd/fitupd.c b/cmd/fitupd.c index f6270d9c15..0f490c58fc 100644 --- a/cmd/fitupd.c +++ b/cmd/fitupd.c @@ -8,10 +8,6 @@ #include <command.h> #include <net.h> -#if !defined(CONFIG_UPDATE_TFTP) -#error "CONFIG_UPDATE_TFTP required" -#endif - static int do_fitupd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -145,13 +145,10 @@ static int do_spi_flash_probe(int argc, char *const argv[]) new = spi_flash_probe(bus, cs, speed, mode); flash = new; - if (!new) { printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); return 1; } - - flash = new; #endif return 0; |