security/tpm/tspi/log: Respect cbmem TPM log size when copying preram entries

Change-Id: I0f08a5bbdb7b823e3a12770154101d49055f263e
This commit is contained in:
Jeremy Soller
2023-02-27 12:29:28 -07:00
parent 0c44e8ed3e
commit 3dc572fc6d

View File

@@ -144,6 +144,11 @@ void tpm_log_copy_entries(const void *from, void *to)
int i; int i;
for (i = 0; i < from_log->num_entries; 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++]; 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); strncpy(tce->name, from_log->entries[i].name, TPM_CB_LOG_PCR_HASH_NAME - 1);