krishnanadh / rpms / rasdaemon

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