Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/61800 )
Change subject: soc/mediatek: Fix printing SPM version ......................................................................
soc/mediatek: Fix printing SPM version
Currently the SPM version string is stored at the end of the blob, possibly without a trailing '\0'. Therefore, we should be careful not to print characters beyond the blob size.
BUG=b:211944565 TEST=emerge-corsola coreboot TEST=SPM version looked good in AP console BRANCH=none
Change-Id: Icfeb686539dc20cf5b78de77c27bdbb137b5d624 Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M src/soc/mediatek/common/spm.c 1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/61800/1
diff --git a/src/soc/mediatek/common/spm.c b/src/soc/mediatek/common/spm.c index c4eabd0..a17fba5 100644 --- a/src/soc/mediatek/common/spm.c +++ b/src/soc/mediatek/common/spm.c @@ -50,5 +50,7 @@ /* Version */ offset += copy_size; assert(offset < file_size); - printk(BIOS_INFO, "SPM: spmfw (version %s)\n", (u8 *)mcu->load_buffer + offset); + printk(BIOS_INFO, "SPM: spmfw (version %.*s)\n", + (int)(file_size - offset), + (u8 *)mcu->load_buffer + offset); }