krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0050-rasdaemon-make-sure-the-error-is-valid-before-handli.patch

ac32bf
From 56913e2f2a5a6ddf8ab684c8d528e9ef1d55cfba Mon Sep 17 00:00:00 2001
ac32bf
From: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
ac32bf
Date: Tue, 26 May 2015 11:59:39 -0300
ac32bf
Subject: [PATCH 10/13] rasdaemon: make sure the error is valid before handling
ac32bf
 ranks
ac32bf
ac32bf
Fix "rank" handling according to the Bit 63 description in Intel SDM Vol.3C
ac32bf
Table 16-23, that says "... Use this information only after there is valid
ac32bf
first error info indicated by bit 62".
ac32bf
Also fix invalid comparisons of unsigned variables "rank0" and "rank1".
ac32bf
ac32bf
Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
ac32bf
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
ac32bf
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
ac32bf
---
ac32bf
 mce-intel-haswell.c | 14 ++++++--------
ac32bf
 1 file changed, 6 insertions(+), 8 deletions(-)
ac32bf
ac32bf
diff --git a/mce-intel-haswell.c b/mce-intel-haswell.c
ac32bf
index 3ac12f2..0a817bf 100644
ac32bf
--- a/mce-intel-haswell.c
ac32bf
+++ b/mce-intel-haswell.c
ac32bf
@@ -174,22 +174,20 @@ void hsw_decode_model(struct ras_events *ras, struct mce_event *e)
ac32bf
 
ac32bf
 	mce_snprintf(e->mc_location, "memory_channel=%d", chan);
ac32bf
 
ac32bf
-	if (EXTRACT(e->misc, 62, 62))
ac32bf
+	if (EXTRACT(e->misc, 62, 62)) {
ac32bf
 		rank0 = EXTRACT(e->misc, 46, 50);
ac32bf
-
ac32bf
-	if (EXTRACT(e->misc, 63, 63))
ac32bf
-		rank1 = EXTRACT(e->misc, 51, 55);
ac32bf
+		if (EXTRACT(e->misc, 63, 63))
ac32bf
+			rank1 = EXTRACT(e->misc, 51, 55);
ac32bf
+	}
ac32bf
 
ac32bf
 	/*
ac32bf
 	 * FIXME: The conversion from rank to dimm requires to parse the
ac32bf
 	 * DMI tables and call failrank2dimm().
ac32bf
 	 */
ac32bf
-	if (rank0 >= 0 && rank1 >= 0)
ac32bf
+	if (rank0 != -1 && rank1 != -1)
ac32bf
 		mce_snprintf(e->mc_location, "ranks=%d and %d",
ac32bf
 				     rank0, rank1);
ac32bf
-	else if (rank0 >= 0)
ac32bf
+	else if (rank0 != -1)
ac32bf
 		mce_snprintf(e->mc_location, "rank=%d", rank0);
ac32bf
-	else
ac32bf
-		mce_snprintf(e->mc_location, "rank=%d", rank1);
ac32bf
 }
ac32bf
 
ac32bf
-- 
ac32bf
1.8.3.1
ac32bf