You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LevelX NOR extended cache size check uses wrong unit #76
In _lx_nor_flash_extended_cache_enable(), the initial size check appears to compare bytes against a word count:
if ((memory) && (size<LX_NOR_SECTOR_SIZE))
{
return(LX_ERROR);
}
size is the RAM cache size in bytes, but LX_NOR_SECTOR_SIZE is defined as:
#defineLX_NOR_SECTOR_SIZE (512 / sizeof(ULONG))
So it represents the number of ULONG words in a 512-byte sector, not bytes.
The rest of the function confirms this, since it converts size to words:
cache_size=size / sizeof(ULONG);
and then compares cache_size against LX_NOR_SECTOR_SIZE.
The current check rejects only sizes below 128 bytes, although it should reject sizes below one NOR sector, i.e. 512 bytes.
Suggested fix: move the cache_size calculation before the validation and check using the same unit:
/* Calculate cache size in words. */cache_size=size / sizeof(ULONG);
/* Determine if memory was specified but with an invalid size. */if ((memory) && (cache_size<LX_NOR_SECTOR_SIZE))
{
return(LX_ERROR);
}
Activity
fdesbiens commentedon Jun 23, 2026
Thank you for the bug report, @miracoli. I will look into it.
fdesbiens commentedon Jun 26, 2026
I submitted PR #78 to address this. Your feedback is welcome, @miracoli.
If it resolves the issue, I will merge to dev. This would ship in the Q3 2026 release.
miracoli commentedon Jun 29, 2026
From my side, this resolves the issue. Thanks for the fast response!
fdesbiens commentedon Jun 30, 2026
PR #78 has been merged.