diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_firmware.c | 10 | ||||
-rw-r--r-- | lib/efi_loader/efi_helper.c | 6 | ||||
-rw-r--r-- | lib/efi_loader/efi_tcg2.c | 19 | ||||
-rw-r--r-- | lib/efi_selftest/efi_selftest_miniapp_exit.c | 2 |
4 files changed, 10 insertions, 27 deletions
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 9fd13297a6..ba5aba098c 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -400,18 +400,18 @@ efi_status_t efi_firmware_set_fmp_state_var(struct fmp_state *state, u8 image_in } size = num_banks * sizeof(*var_state); - var_state = calloc(1, size); + var_state = malloc(size); if (!var_state) return EFI_OUT_OF_RESOURCES; /* * GetVariable may fail, EFI_NOT_FOUND is returned if FmpState * variable has not been set yet. - * Ignore the error here since the correct FmpState variable - * is set later. */ - efi_get_variable_int(varname, image_type_id, NULL, &size, var_state, - NULL); + ret = efi_get_variable_int(varname, image_type_id, NULL, &size, + var_state, NULL); + if (ret != EFI_SUCCESS) + memset(var_state, 0, num_banks * sizeof(*var_state)); /* * Only the fw_version is set here. diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 11066eb505..5dd9cc876e 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -380,12 +380,12 @@ done: } /** - * get_config_table() - get configuration table + * efi_get_configuration_table() - get configuration table * * @guid: GUID of the configuration table * Return: pointer to configuration table or NULL */ -static void *get_config_table(const efi_guid_t *guid) +void *efi_get_configuration_table(const efi_guid_t *guid) { size_t i; @@ -430,7 +430,7 @@ efi_status_t efi_install_fdt(void *fdt) uintptr_t fdt_addr; /* Look for device tree that is already installed */ - if (get_config_table(&efi_guid_fdt)) + if (efi_get_configuration_table(&efi_guid_fdt)) return EFI_SUCCESS; /* Check if there is a hardware device tree */ fdt_opt = env_get("fdt_addr"); diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 85562c50a1..b5d4aa7be5 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1129,23 +1129,6 @@ out: } /** - * find_smbios_table() - find smbios table - * - * Return: pointer to the smbios table - */ -static void *find_smbios_table(void) -{ - u32 i; - - for (i = 0; i < systab.nr_tables; i++) { - if (!guidcmp(&smbios3_guid, &systab.tables[i].guid)) - return systab.tables[i].table; - } - - return NULL; -} - -/** * tcg2_measure_gpt_table() - measure gpt table * * @dev: TPM device @@ -1387,7 +1370,7 @@ efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *ha if (ret != EFI_SUCCESS) goto out; - entry = (struct smbios3_entry *)find_smbios_table(); + entry = efi_get_configuration_table(&smbios3_guid); if (entry) { ret = tcg2_measure_smbios(dev, entry); if (ret != EFI_SUCCESS) diff --git a/lib/efi_selftest/efi_selftest_miniapp_exit.c b/lib/efi_selftest/efi_selftest_miniapp_exit.c index 8b2e60cc71..0909a5ca74 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_exit.c +++ b/lib/efi_selftest/efi_selftest_miniapp_exit.c @@ -39,7 +39,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { cout->output_string(cout, - u"Could not open loaded image protocol"); + u"Could not open loaded image protocol\n"); return ret; } if ((void *)check_loaded_image_protocol < |