From 0b6ea22049bc32c1cfa96060ebf0a8ac06946cfe Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Tue, 26 Nov 2024 15:38:54 +0100 Subject: [PATCH] sys/log: Zero-initialize log_offset struct 1063e8201 added new field to log_offset struct so functions that define that struct on stack may have random results if struct is not initialized properly. --- sys/log/full/src/log.c | 2 +- sys/log/full/src/log_fcb.c | 2 +- sys/log/full/src/log_fcb2.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/log/full/src/log.c b/sys/log/full/src/log.c index 4242e4c58e..978924e6b2 100644 --- a/sys/log/full/src/log.c +++ b/sys/log/full/src/log.c @@ -336,7 +336,7 @@ static int log_read_last_hdr(struct log *log, struct log_entry_hdr *out_hdr) { struct log_read_hdr_arg arg; - struct log_offset log_offset; + struct log_offset log_offset = {}; arg.hdr = out_hdr; arg.read_success = 0; diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c index 5ed6408204..0099462ed0 100644 --- a/sys/log/full/src/log_fcb.c +++ b/sys/log/full/src/log_fcb.c @@ -804,7 +804,7 @@ static int log_fcb_set_watermark(struct log *log, uint32_t index) { int rc; - struct log_offset log_offset; + struct log_offset log_offset = {}; struct fcb_log *fl; struct fcb *fcb; diff --git a/sys/log/full/src/log_fcb2.c b/sys/log/full/src/log_fcb2.c index 826150a125..b307acfe94 100644 --- a/sys/log/full/src/log_fcb2.c +++ b/sys/log/full/src/log_fcb2.c @@ -693,7 +693,7 @@ static int log_fcb2_set_watermark(struct log *log, uint32_t index) { int rc; - struct log_offset log_offset; + struct log_offset log_offset = {}; struct fcb_log *fl; struct fcb2 *fcb;