From 10824b0655f3eeaeac87ae6e4e3881429a237f3e Mon Sep 17 00:00:00 2001 From: Craig Small Date: Tue, 2 Nov 2021 17:23:37 +1100 Subject: [PATCH] lib: Initialise uptime variables upminutes and uphours could both not get initialised in the procps_uptime_sprint_short() function. Error was probably introduced at the referenced commit. References: Coverity 240787 Uninitialized scalar variable Coverity 240776 Uninitialized scalar variable commit 0496b39876d569fe1cecb76ad5ef212cd14c0374 Signed-off-by: Craig Small --- proc/uptime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/uptime.c b/proc/uptime.c index 39ba5188..088cd68a 100644 --- a/proc/uptime.c +++ b/proc/uptime.c @@ -151,7 +151,7 @@ PROCPS_EXPORT char *procps_uptime_sprint(void) */ PROCPS_EXPORT char *procps_uptime_sprint_short(void) { - int updecades, upyears, upweeks, updays, uphours, upminutes; + int updecades, upyears, upweeks, updays, uphours, upminutes = 0; int pos = 3; int comma = 0; double uptime_secs, idle_secs;