krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0038-rasdaemon-fix-mce-numfield-decoded-error.patch

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