mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 20:04:46 +00:00
efi_selftest: error handling in efi_selftest_tcg2
If memory allocation fails, write an error message. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
0db8221f32
commit
c900a42eb0
1 changed files with 6 additions and 2 deletions
|
@ -631,8 +631,10 @@ static int efi_st_tcg2_setup(const efi_handle_t img_handle,
|
||||||
sizeof(struct efi_tcg2_event) +
|
sizeof(struct efi_tcg2_event) +
|
||||||
sizeof(struct uefi_image_load_event),
|
sizeof(struct uefi_image_load_event),
|
||||||
(void **)&efi_tcg2_event);
|
(void **)&efi_tcg2_event);
|
||||||
if (!efi_tcg2_event)
|
if (ret != EFI_SUCCESS) {
|
||||||
|
efi_st_error("Out of memory\n");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
efi_tcg2_event->size = sizeof(struct efi_tcg2_event) +
|
efi_tcg2_event->size = sizeof(struct efi_tcg2_event) +
|
||||||
sizeof(struct uefi_image_load_event);
|
sizeof(struct uefi_image_load_event);
|
||||||
|
@ -659,8 +661,10 @@ static int efi_st_tcg2_setup(const efi_handle_t img_handle,
|
||||||
(EFI_TCG2_MAX_PCR_INDEX + 1) *
|
(EFI_TCG2_MAX_PCR_INDEX + 1) *
|
||||||
TPM2_SHA256_DIGEST_SIZE,
|
TPM2_SHA256_DIGEST_SIZE,
|
||||||
(void **)&pcrs);
|
(void **)&pcrs);
|
||||||
if (!pcrs)
|
if (ret != EFI_SUCCESS) {
|
||||||
|
efi_st_error("Out of memory\n");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
boottime->set_mem(pcrs, (EFI_TCG2_MAX_PCR_INDEX + 1) * TPM2_SHA256_DIGEST_SIZE, 0);
|
boottime->set_mem(pcrs, (EFI_TCG2_MAX_PCR_INDEX + 1) * TPM2_SHA256_DIGEST_SIZE, 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue