]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: make sure the error is valid before handling ranks
authorSeiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Tue, 26 May 2015 14:59:39 +0000 (11:59 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 3 Jun 2015 13:39:51 +0000 (10:39 -0300)
Fix "rank" handling according to the Bit 63 description in Intel SDM Vol.3C
Table 16-23, that says "... Use this information only after there is valid
first error info indicated by bit 62".
Also fix invalid comparisons of unsigned variables "rank0" and "rank1".

Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
mce-intel-haswell.c

index 3ac12f2860789418a5e5719a680dac0f2e1de91c..0a817bf6047bba4cfb2dbc14aec475e62a0200ae 100644 (file)
@@ -174,22 +174,20 @@ void hsw_decode_model(struct ras_events *ras, struct mce_event *e)
 
        mce_snprintf(e->mc_location, "memory_channel=%d", chan);
 
-       if (EXTRACT(e->misc, 62, 62))
+       if (EXTRACT(e->misc, 62, 62)) {
                rank0 = EXTRACT(e->misc, 46, 50);
-
-       if (EXTRACT(e->misc, 63, 63))
-               rank1 = EXTRACT(e->misc, 51, 55);
+               if (EXTRACT(e->misc, 63, 63))
+                       rank1 = EXTRACT(e->misc, 51, 55);
+       }
 
        /*
         * FIXME: The conversion from rank to dimm requires to parse the
         * DMI tables and call failrank2dimm().
         */
-       if (rank0 >= 0 && rank1 >= 0)
+       if (rank0 != -1 && rank1 != -1)
                mce_snprintf(e->mc_location, "ranks=%d and %d",
                                     rank0, rank1);
-       else if (rank0 >= 0)
+       else if (rank0 != -1)
                mce_snprintf(e->mc_location, "rank=%d", rank0);
-       else
-               mce_snprintf(e->mc_location, "rank=%d", rank1);
 }