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