security/tpm: Check for NULL pointer

Change bce49c2 (security/tpm: Improve TCPA log generation) missed
checking for NULL pointer before accessing the tcpa_table returned by
tcpa_log_init. This change fixes the boot hang observed on octopus by
ensuring pointer is checked for NULL before using it.

BUG=b:111403731
TEST=Verified that octopus boots up fine.

Change-Id: I2e46197065f8db1dc028a85551546263e60d46b2
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/27933
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh 2018-08-07 09:57:40 -07:00 committed by Philipp Deppenwiese
parent 27bb066b9e
commit c49ab459bc
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ void tcpa_log_add_table_entry(const char *name, const uint32_t pcr,
struct tcpa_entry *tce;
tclt = tcpa_log_init();
if (!tclt)
return;
if (tclt->num_entries == tclt->max_entries) {
printk(BIOS_WARNING, "ERROR: TCPA log table is full\n");
return;