This is an automated email from the ASF dual-hosted git repository.
vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 13d03be1c sys/log: Zero-initialize log_offset struct (#3348)
13d03be1c is described below
commit 13d03be1ce73e4573f624f8b11d54eebb3442d41
Author: Andrzej Kaczmarek <[email protected]>
AuthorDate: Tue Nov 26 21:56:40 2024 +0100
sys/log: Zero-initialize log_offset struct (#3348)
- 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 4242e4c58..978924e6b 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 5ed640820..0099462ed 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 826150a12..b307acfe9 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;