From 07ad2d9439749c5d0681f3c0e988b300865dbadb Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 13 Jul 2021 21:07:12 +0200 Subject: [PATCH] soc/amd/picasso: check length of mca_bank_name array The length of mca_bank_name should match the return value of mca_get_bank_count which gets the number of MCA banks from an MSR. TEST=No error message on serial console on amd/mandolin Change-Id: Ibdad51a7ef27266e110dfbb43188361952618342 Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/56274 Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/picasso/mca.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/soc/amd/picasso/mca.c b/src/soc/amd/picasso/mca.c index fcc9d3e155..ade8c503e0 100644 --- a/src/soc/amd/picasso/mca.c +++ b/src/soc/amd/picasso/mca.c @@ -184,6 +184,9 @@ static void mca_check_all_banks(void) struct mca_bank_status mci; const unsigned int num_banks = mca_get_bank_count(); + if (ARRAY_SIZE(mca_bank_name) != num_banks) + printk(BIOS_WARNING, "CPU has an unexpected number of MCA banks!\n"); + for (unsigned int i = 0 ; i < num_banks ; i++) { mci.bank = i; mci.sts = rdmsr(MCAX_STATUS_MSR(i));