mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
pios_jedec: fixed usage of uninitialized memory
When reading the jedec device id the code only transfered one byte via spi leaving the expected input buffer uninitialized. This may lead to the problem that flash initialization fails because the expected input may be whatever the stack was set when entering the function. The impact of the bug is somewhat limited tough as the initialization usually takes place before starting up the rtos and thus is pretty deterministic. So if the code passed init while testing it should pass init in production as well.
This commit is contained in:
parent
994b9d209a
commit
3db04ea174
@ -249,7 +249,7 @@ int32_t PIOS_Flash_Jedec_ReadStatus()
|
||||
*/
|
||||
int32_t PIOS_Flash_Jedec_ReadID()
|
||||
{
|
||||
uint8_t out[] = {JEDEC_DEVICE_ID};
|
||||
uint8_t out[] = {JEDEC_DEVICE_ID, 0, 0, 0};
|
||||
uint8_t in[4];
|
||||
if (PIOS_Flash_Jedec_ClaimBus() < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user