Skip to content

Commit

Permalink
[fix]修复log index2addr 溢出实际物理地址空间风险
Browse files Browse the repository at this point in the history
Signed-off-by: jaffer <[email protected]>
  • Loading branch information
i-jaffer committed Dec 10, 2022
1 parent af12a8e commit a5f0947
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions easyflash/src/ef_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ static uint32_t log_index2addr(size_t index) {
if (log_start_addr + index + header_total_offset < log_area_start_addr + LOG_AREA_SIZE) {
return log_start_addr + index + header_total_offset;
} else {
return log_start_addr + index + header_total_offset - LOG_AREA_SIZE;

return (log_start_addr + index + header_total_offset) % LOG_AREA_SIZE;
}
}
}
Expand Down

0 comments on commit a5f0947

Please sign in to comment.