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 <reitbergerfred@gmail.com>
Change-Id: Ib334daa8518a92e0cf3d22c4d95908f4c84afe04
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72911
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Fred Reitberger 2023-02-08 16:05:08 -05:00 committed by Felix Held
parent 84aa9a74e8
commit f9eeded219
1 changed files with 1 additions and 1 deletions

View File

@ -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 /* The UPD signatures are non-zero-terminated ASCII stored as a little endian
uint64_t, so this needs some casts. */ uint64_t, so this needs some casts. */
die_with_post_code(POST_INVALID_VENDOR_BINARY, 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 *)&upd_signature,
(char *)&expected_signature); (char *)&expected_signature);
} }