krishnanadh / rpms / rasdaemon

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