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