Skip to content

Commit

Permalink
sys/log: Zero-initialize log_offset struct (#3348)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
andrzej-kaczmarek authored Nov 26, 2024
1 parent 2c5ce7f commit 13d03be
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sys/log/full/src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sys/log/full/src/log_fcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion sys/log/full/src/log_fcb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 13d03be

Please sign in to comment.