f6ed37
commit e8b97ec14a11764fedfea50bd4d96ddda43c7fc1
f6ed37
Author: Aristeu Rozanski <arozansk@redhat.com>
f6ed37
Date:   Thu Jan 19 08:45:57 2023 -0500
f6ed37
f6ed37
    rasdaemon: mce-amd-smca: properly limit bank types
f6ed37
    
f6ed37
    Found with covscan.
f6ed37
    
f6ed37
    Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
f6ed37
    Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
f6ed37
f6ed37
diff --git a/mce-amd-smca.c b/mce-amd-smca.c
f6ed37
index f3379fc..27ca8aa 100644
f6ed37
--- a/mce-amd-smca.c
f6ed37
+++ b/mce-amd-smca.c
f6ed37
@@ -584,7 +584,7 @@ static void decode_smca_error(struct mce_event *e)
f6ed37
 		return;
f6ed37
 	}
f6ed37
 
f6ed37
-	if (bank_type >= MAX_NR_BANKS) {
f6ed37
+	if (bank_type >= N_SMCA_BANK_TYPES) {
f6ed37
 		strcpy(e->mcastatus_msg, "Don't know how to decode this bank");
f6ed37
 		return;
f6ed37
 	}