From 3dc572fc6d625a98de0d2cf1dee479047b0c1c06 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 27 Feb 2023 12:29:28 -0700 Subject: [PATCH] security/tpm/tspi/log: Respect cbmem TPM log size when copying preram entries Change-Id: I0f08a5bbdb7b823e3a12770154101d49055f263e --- src/security/tpm/tspi/log.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c index 8796c74b2b..0276f22b83 100644 --- a/src/security/tpm/tspi/log.c +++ b/src/security/tpm/tspi/log.c @@ -144,6 +144,11 @@ void tpm_log_copy_entries(const void *from, void *to) int i; for (i = 0; i < from_log->num_entries; i++) { + if (to_log->num_entries >= to_log->max_entries) { + printk(BIOS_WARNING, "TPM LOG: log table is full\n"); + return; + } + struct tpm_cb_log_entry *tce = &to_log->entries[to_log->num_entries++]; strncpy(tce->name, from_log->entries[i].name, TPM_CB_LOG_PCR_HASH_NAME - 1);