linux/drivers/char/tpm/eventlog
Thorsten Blum 1a58f6115b tpm: fix event_size output in tpm1_binary_bios_measurements_show
Commit 186d124f07 ("tpm_eventlog.c: fix binary_bios_measurements")
split the output to write the endian-converted event header first and
then the variable-length event data.

However, the split was at sizeof(struct tcpa_event) - 1, even though
event_data was a zero-length array, and later a flexible array member,
both of which already excluded the event data.

Therefore, the current code writes the first three bytes of event_size
from the endian-converted header and then the last byte from the raw
header, which can emit a corrupted event_size on PPC64, where
do_endian_conversion() maps to be32_to_cpu().

Split one byte later to write the full endian-converted header first,
followed by the variable-length event->event_data.

Fixes: 186d124f07 ("tpm_eventlog.c: fix binary_bios_measurements")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-06-21 04:25:28 +03:00
..
acpi.c tpm: Change to kvalloc() in eventlog/acpi.c 2025-01-23 10:52:23 +02:00
common.c tpm: don't bother with removal of files in directory we'll be removing 2025-06-17 18:11:01 -04:00
common.h tpm: Move eventlog declarations to its own header 2018-05-09 14:45:46 +03:00
efi.c tpm: Use managed allocation for bios event log 2023-02-13 10:11:20 +02:00
of.c tpm: Use of_reserved_mem_region_to_resource() for "memory-region" 2025-07-23 02:23:18 +03:00
tpm1.c tpm: fix event_size output in tpm1_binary_bios_measurements_show 2026-06-21 04:25:28 +03:00
tpm2.c tpm: eventlog: Replace zero-length array with flexible-array member 2020-05-22 18:50:12 +03:00