From f9eeded219d7e75154989d11ec1c70445523fada Mon Sep 17 00:00:00 2001 From: Fred Reitberger Date: Wed, 8 Feb 2023 16:05:08 -0500 Subject: [PATCH] drivers/fsp2: Don't print garbage if the FSP signature doesn't match Using a &uint64_t as a string argument does not include the required NULL character termination. Update the format string to only print the 8 desired characters and not continue printing stack memory until a NULL is found. Before: [EMERG] Invalid UPD signature! FSP provided "AMD_01_M;....`", expected was "CEZANE_MAMD_01_M;....`". After: [EMERG] Invalid UPD signature! FSP provided "AMD_01_M", expected was "CEZANE_M". Signed-off-by: Fred Reitberger Change-Id: Ib334daa8518a92e0cf3d22c4d95908f4c84afe04 Reviewed-on: https://review.coreboot.org/c/coreboot/+/72911 Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- src/drivers/intel/fsp2_0/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c index 1dedb6587f..7fa2af4722 100644 --- a/src/drivers/intel/fsp2_0/util.c +++ b/src/drivers/intel/fsp2_0/util.c @@ -183,7 +183,7 @@ void fsp_verify_upd_header_signature(uint64_t upd_signature, uint64_t expected_s /* The UPD signatures are non-zero-terminated ASCII stored as a little endian uint64_t, so this needs some casts. */ die_with_post_code(POST_INVALID_VENDOR_BINARY, - "Invalid UPD signature! FSP provided \"%8s\", expected was \"%8s\".\n", + "Invalid UPD signature! FSP provided \"%.8s\", expected was \"%.8s\".\n", (char *)&upd_signature, (char *)&expected_signature); }