krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0070-rasdaemon-ARM-fully-initialize-ras_arm_event.patch

d9e469
commit 1b23bf7d97bacd1d00adb4404dfc5004df394358
d9e469
Author: Aristeu Rozanski <arozansk@redhat.com>
d9e469
Date:   Fri Feb 2 10:15:25 2018 -0500
d9e469
d9e469
    ARM: initialize with 0 unused ras_arm_event members
d9e469
    
d9e469
    Issue found by covscan:
d9e469
    
d9e469
    1. rasdaemon-0.4.1/ras-arm-handler.c:32: var_decl: Declaring variable "ev" without initializer.
d9e469
    16. rasdaemon-0.4.1/ras-arm-handler.c:81: uninit_use_in_call: Using uninitialized value "ev.error_count" when calling "ras_store_arm_record".
d9e469
    23. rasdaemon-0.4.1/ras-record.c:243:2: read_parm_fld: Reading a parameter field.
d9e469
    
d9e469
    Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
d9e469
d9e469
diff --git a/ras-arm-handler.c b/ras-arm-handler.c
d9e469
index a76470d..2f170e2 100644
d9e469
--- a/ras-arm-handler.c
d9e469
+++ b/ras-arm-handler.c
d9e469
@@ -31,6 +31,8 @@ int ras_arm_event_handler(struct trace_seq *s,
d9e469
 	struct tm *tm;
d9e469
 	struct ras_arm_event ev;
d9e469
 
d9e469
+	memset(&ev, 0, sizeof(ev));
d9e469
+
d9e469
 	/*
d9e469
 	 * Newer kernels (3.10-rc1 or upper) provide an uptime clock.
d9e469
 	 * On previous kernels, the way to properly generate an event would