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

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c4cf7ead306fed6cfd519f0741d8e64b1d5c1d52
Author: zhaoxingyu1 <[email protected]>
AuthorDate: Thu Dec 12 18:44:06 2024 +0800

    bugfix: reading expired content need in expired range
    
    By obtaining the erase value to set the nvs special ID
    instead of using a fixed value
    
    Signed-off-by: zhaoxingyu1 <[email protected]>
---
 drivers/mtd/mtd_config_fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtd_config_fs.c b/drivers/mtd/mtd_config_fs.c
index 5b6fb2d5137..37215d5e198 100644
--- a/drivers/mtd/mtd_config_fs.c
+++ b/drivers/mtd/mtd_config_fs.c
@@ -201,7 +201,8 @@ static inline size_t nvs_buffer_size(FAR struct nvs_fs *fs)
 static inline bool nvs_ate_expired(FAR struct nvs_fs *fs,
                                    FAR struct nvs_ate *entry)
 {
-  return entry->expired[nvs_align_up(fs, sizeof(*entry))] != fs->erasestate;
+  return entry->expired[nvs_align_up(fs, sizeof(*entry)) - sizeof(*entry)] !=
+         fs->erasestate;
 }
 
 /****************************************************************************

Reply via email to