Describe the bug
The loop below checks on the cache_size only, but accessing the nor_flash -> lx_nor_flash_extended_cache[i] array
incrementing the index without any check.
https://github.com/eclipse-threadx/levelx/blob/04e385f3d5586efdd5dffb1dd4c8ffa50317d70a/common/src/lx_nor_flash_extended_cache_enable.c#L293C4-L309C6
the fix is to change the while() condition as following
while((cache_size >= LX_NOR_SECTOR_SIZE) && i < LX_NOR_EXTENDED_CACHE_SIZE)
also replace the line
|
if(i > LX_NOR_EXTENDED_CACHE_SIZE) |
with
if(i == LX_NOR_EXTENDED_CACHE_SIZE)
regards
haithem.
Describe the bug
The loop below checks on the cache_size only, but accessing the
nor_flash -> lx_nor_flash_extended_cache[i]arrayincrementing the index without any check.
https://github.com/eclipse-threadx/levelx/blob/04e385f3d5586efdd5dffb1dd4c8ffa50317d70a/common/src/lx_nor_flash_extended_cache_enable.c#L293C4-L309C6
the fix is to change the
while()condition as followingwhile((cache_size >= LX_NOR_SECTOR_SIZE) && i < LX_NOR_EXTENDED_CACHE_SIZE)also replace the line
levelx/common/src/lx_nor_flash_extended_cache_enable.c
Line 312 in 04e385f
with
if(i == LX_NOR_EXTENDED_CACHE_SIZE)regards
haithem.