From f5237d5df19e1dc2f3082289bfe1fba23bdde2d5 Mon Sep 17 00:00:00 2001 From: Sebastian Block Date: Sun, 26 Feb 2023 11:03:29 +0100 Subject: [PATCH] fs/fcb2: fix endless loop in fcb2_getprev if a flash error occurs --- fs/fcb2/src/fcb_getprev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fcb2/src/fcb_getprev.c b/fs/fcb2/src/fcb_getprev.c index f543b5d90f..6d41f44ba4 100644 --- a/fs/fcb2/src/fcb_getprev.c +++ b/fs/fcb2/src/fcb_getprev.c @@ -34,7 +34,7 @@ fcb2_sector_find_last(struct fcb2 *fcb, struct fcb2_entry *loc) if (rc == 0) { last_valid = loc->fe_entry_num; } - if (rc == FCB2_ERR_NOVAR) { + else if (rc == FCB2_ERR_NOVAR) { /* * Out entries in this sector */ @@ -52,7 +52,7 @@ fcb2_sector_find_last(struct fcb2 *fcb, struct fcb2_entry *loc) } } loc->fe_entry_num++; - } while (1); + } while (rc == 0); return rc; }