This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit ab3f5e376afc0edac49d9bf7d00f9c0a6158b7a3
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Wed Aug 7 13:25:35 2024 +0200

    fs/fcb: Fix fcb_walk local variable initialization
    
    fcb_walk initialize only certain fields of fcb_entry
    before walking.
    This could lead to unpredictable behaviour if additional
    fields were utilized.
    
    Signed-off-by: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
---
 fs/fcb/src/fcb_walk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/fcb/src/fcb_walk.c b/fs/fcb/src/fcb_walk.c
index b3e61fde6..9daf55f23 100644
--- a/fs/fcb/src/fcb_walk.c
+++ b/fs/fcb/src/fcb_walk.c
@@ -27,11 +27,10 @@
 int
 fcb_walk(struct fcb *fcb, struct flash_area *fap, fcb_walk_cb cb, void *cb_arg)
 {
-    struct fcb_entry loc;
+    struct fcb_entry loc = {0};
     int rc;
 
     loc.fe_area = fap;
-    loc.fe_elem_off = 0;
 
     rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
     if (rc && rc != OS_NOT_STARTED) {

Reply via email to