From 4cd9ac0a55bdd010d6aeed841f51c480d1437724 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 13 Mar 2021 02:38:23 +0100 Subject: soc/amd/picasso/mca: don't do out of bounds array accesses The Picasso APUs advertise 23 MCA banks in the lower byte of the IA32_MCG_CAP MSR, which is more than the 7 core MCA banks. Signed-off-by: Felix Held Change-Id: I3e1c8ed437820b350c78b0517e6521582002ee1e Reviewed-on: https://review.coreboot.org/c/coreboot/+/51477 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Marshall Dawson --- src/soc/amd/picasso/mca.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/soc/amd/picasso') diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index 5471a6bfc7..8ea5276450 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -162,7 +162,8 @@ void check_mca(void) int core = cpuid_ebx(1) >> 24; printk(BIOS_WARNING, "#MC Error: core %d, bank %d %s\n", - core, i, mca_bank_name[i]); + core, i, + i < ARRAY_SIZE(mca_bank_name) ? mca_bank_name[i] : ""); printk(BIOS_WARNING, " MC%d_STATUS = %08x_%08x\n", i, mci.sts.hi, mci.sts.lo); -- cgit v1.2.3