krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone
d9e469
commit f20a366a9b7a32a1be6fc89e7546cc2b4cb690bf
d9e469
Author: Xie XiuQi <xiexiuqi@huawei.com>
d9e469
Date:   Thu May 8 20:07:19 2014 +0800
d9e469
d9e469
    rasdaemon: fix mce numfield decoded error
d9e469
    
d9e469
    Some fields are missing in mce decode information, as below:
d9e469
    ...
d9e469
    rasdaemon: register inserted at db
d9e469
               <...>-31568 [000]  4023.214080: mce_record:
d9e469
    2014-05-07 15:51:16 +0800 bank=2, status= bd000000000000c0, MEMORY
d9e469
    CONTROLLER MS_CHANNEL0_ERR Transaction: Memory scrubbing error %s: %Lu
d9e469
     %s: %Lx
d9e469
     %s: %Lx
d9e469
     %s: %Lu
d9e469
     %s: %Lu
d9e469
     %s: %Lx
d9e469
    , mci=Uncorrected_error Error_enabled SRAO, n_errors=0 channel=0,
d9e469
    dimm=0, cpu_type= Intel Xeon 5500 series / Core i3/5/7
d9e469
    ("Nehalem/Westmere"), cpu= 0, socketid= 0, ip= 1eadbabe (INEXACT), cs=
d9e469
    73, misc= 8c, addr= 62b000, mcgstatus= 5 RIPV MCIP, mcgcap= 1c09,
d9e469
    apicid= 0
d9e469
    
d9e469
    "f->name" & "v" are missed to print in decode_numfield(), so fix it.
d9e469
    
d9e469
    Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
d9e469
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
d9e469
d9e469
diff --git a/bitfield.c b/bitfield.c
d9e469
index b2895b4..07795a9 100644
d9e469
--- a/bitfield.c
d9e469
+++ b/bitfield.c
d9e469
@@ -92,8 +92,9 @@ void decode_numfield(struct mce_event *e, uint64_t status,
d9e469
 		uint64_t mask = (1ULL << (f->end - f->start + 1)) - 1;
d9e469
 		uint64_t v = (status >> f->start) & mask;
d9e469
 		if (v > 0 || f->force) {
d9e469
-			mce_snprintf(e->error_msg, "%%s: %s\n",
d9e469
-				     f->fmt ? f->fmt : "%Lu");
d9e469
+			char fmt[32] = {0};
d9e469
+			snprintf(fmt, 32, "%%s: %s\n", f->fmt ? f->fmt : "%Lu");
d9e469
+			mce_snprintf(e->error_msg, fmt, f->name, v);
d9e469
 		}
d9e469
 	}
d9e469
 }