mirror of
https://github.com/apache/nuttx.git
synced 2025-12-10 12:14:36 +08:00
samv7: fix bytes to words calculation in user signature read
EEFC read sequence requires read length in words instead of bytes, therefore bytes given by the user has to be recalculated to words. The calculation however had a mistake in brackets and was just adding 1 to buflen instead of recalculating it to 4 byte words. This caused global array g_page_buffer to overflow for some reads. This fixes the calculation. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
@@ -177,7 +177,7 @@ int sam_read_user_signature(void *buffer, size_t buflen)
|
||||
|
||||
/* sam_eefc_readsequence requires read length in bit words. */
|
||||
|
||||
nwords = (buflen + sizeof(uint32_t) / sizeof(uint32_t));
|
||||
nwords = (buflen + sizeof(uint32_t)) / sizeof(uint32_t);
|
||||
sam_eefc_readsequence(FCMD_STUS, FCMD_SPUS, g_page_buffer, nwords);
|
||||
|
||||
/* Copy local buffer to void *buffer provided by the user. */
|
||||
|
||||
Reference in New Issue
Block a user