Skip to content

Commit

Permalink
pal: fix unilitialized variables
Browse files Browse the repository at this point in the history
for static code analysis

Signed-off-by: Krzysztof Taborowski <[email protected]>
  • Loading branch information
ktaborowski committed Sep 5, 2024
1 parent ca09f3e commit 4458efb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions subsys/sal/sid_pal/src/sid_mfg_hex_v8.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ int parse_mfg_raw_tlv(tlv_ctx *tlv)

uint8_t payload_buffer[CONFIG_SIDEWALK_MFG_PARSER_MAX_ELEMENT_SIZE] = { 0 };
for (; offset < tlv->end_offset;) {
uint8_t key[2];
uint8_t size[2];
uint8_t key[2] = { 0 };
uint8_t size[2] = { 0 };
int ret = tlv->storage_impl.read(tlv->storage_impl.ctx, offset, key, sizeof(key));
if (ret != 0) {
LOG_ERR("Failed to read data");
Expand Down
2 changes: 1 addition & 1 deletion subsys/sal/sid_pal/src/sid_mfg_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void sid_pal_mfg_store_init(sid_pal_mfg_store_region_t mfg_store_region)
.end_offset = mfg_store_region.addr_end,
.tlv_storage_start_marker_size = sizeof(struct mfg_header) };

struct mfg_header header;
struct mfg_header header = { 0 };
int ret = tlv_read_start_marker(&tlv_flash, (uint8_t *)&header, sizeof(header));
if (ret != 0 ||
strncmp(header.magic_string, MFG_HEADER_MAGIC, strlen(MFG_HEADER_MAGIC)) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion utils/tlv/tlv.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static uint32_t get_next_free_offset(tlv_ctx *ctx)
}
for (uint32_t offset = ctx->start_offset + ctx->tlv_storage_start_marker_size;
offset <= ctx->end_offset;) {
uint8_t header_raw[4];
uint8_t header_raw[4] = { 0 };
int ret = ctx->storage_impl.read(ctx->storage_impl.ctx, offset, header_raw,
sizeof(header_raw));
if (ret != 0) {
Expand Down

0 comments on commit 4458efb

Please sign in to comment.