From ac971cb63d19c2ea41a065a917811d9b865b5b16 Mon Sep 17 00:00:00 2001 From: jaffer Date: Tue, 23 May 2023 22:16:15 +0800 Subject: [PATCH] [feat]fix byte alignment logic judgment error bug. Signed-off-by: jaffer --- easyflash/src/ef_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easyflash/src/ef_log.c b/easyflash/src/ef_log.c index 7e4da13..72709e1 100644 --- a/easyflash/src/ef_log.c +++ b/easyflash/src/ef_log.c @@ -506,11 +506,11 @@ EfErrCode ef_log_read(size_t index, uint32_t *log, size_t size) { return result; } - if (size % 4 == 0) { + if (size % 4 != 0) { EF_DEBUG("Error: size must be word aligned."); return EF_READ_ERR; } - if (index < cur_using_size) { + if (index >= cur_using_size) { EF_DEBUG("Error: index out of ranges, current using size is %d", cur_using_size); return EF_READ_ERR; }