From c49ab459bc726197208134ba5585522ce4d9cad3 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 7 Aug 2018 09:57:40 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/27933 Tested-by: build bot (Jenkins) Reviewed-by: Justin TerAvest Reviewed-by: Aaron Durbin --- src/security/tpm/tspi/log.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/security') diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c index 0a6655a516..17f6f1f3b9 100644 --- a/src/security/tpm/tspi/log.c +++ b/src/security/tpm/tspi/log.c @@ -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; -- cgit v1.2.3