diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-05-01 11:34:15 +0200 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-05-03 21:39:22 +0200 |
commit | c900a42eb0a82d3d7cd18f3255acf92dd9894b92 (patch) | |
tree | 5968b90ec2e202363f759adf4c0250fa5268abcc | |
parent | 0db8221f323efe9c92e569b2d741229e020f3e08 (diff) | |
download | u-boot-c900a42eb0a82d3d7cd18f3255acf92dd9894b92.tar.gz u-boot-c900a42eb0a82d3d7cd18f3255acf92dd9894b92.tar.bz2 u-boot-c900a42eb0a82d3d7cd18f3255acf92dd9894b92.zip |
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>
-rw-r--r-- | lib/efi_selftest/efi_selftest_tcg2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/efi_selftest/efi_selftest_tcg2.c b/lib/efi_selftest/efi_selftest_tcg2.c index a2b4a79e9b..67a886efaa 100644 --- a/lib/efi_selftest/efi_selftest_tcg2.c +++ b/lib/efi_selftest/efi_selftest_tcg2.c @@ -631,8 +631,10 @@ static int efi_st_tcg2_setup(const efi_handle_t img_handle, sizeof(struct efi_tcg2_event) + sizeof(struct uefi_image_load_event), (void **)&efi_tcg2_event); - if (!efi_tcg2_event) + if (ret != EFI_SUCCESS) { + efi_st_error("Out of memory\n"); return EFI_ST_FAILURE; + } efi_tcg2_event->size = sizeof(struct efi_tcg2_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) * TPM2_SHA256_DIGEST_SIZE, (void **)&pcrs); - if (!pcrs) + if (ret != EFI_SUCCESS) { + efi_st_error("Out of memory\n"); return EFI_ST_FAILURE; + } boottime->set_mem(pcrs, (EFI_TCG2_MAX_PCR_INDEX + 1) * TPM2_SHA256_DIGEST_SIZE, 0); |