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

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