Skip to content

Commit

Permalink
fix(MiscDrivers): Allow valid param `address + txlen <= W25_DEVICE_SI…
Browse files Browse the repository at this point in the history
…ZE` when calling Ext_Flash_Program_Page() (#748)
  • Loading branch information
khpeterson authored Oct 2, 2023
1 parent 57cc6af commit 54922aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Libraries/MiscDrivers/ExtMemory/Ext_Flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int Ext_Flash_Write_SR(uint8_t value, Ext_Flash_StatusReg_t reg_num);
* @retval 0 Success
* @retval Non-zero Error condition
*/
int Ext_Flash_Flash_Block_WP(uint32_t addr, uint32_t begin);
int Ext_Flash_Block_WP(uint32_t addr, uint32_t begin);

/**
* @brief Returns the start and end address of the available flash memory based on the current write protection scheme
Expand Down
2 changes: 1 addition & 1 deletion Libraries/MiscDrivers/ExtMemory/w25.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ int Ext_Flash_Program_Page(uint32_t address, uint8_t *tx_buf, uint32_t tx_len,
}

// if flash address is out-of-range
if ((address >= W25_DEVICE_SIZE) || ((address + tx_len) >= W25_DEVICE_SIZE)) {
if ((address >= W25_DEVICE_SIZE) || ((address + tx_len) > W25_DEVICE_SIZE)) {
return EF_E_BAD_PARAM; // attempt to write outside flash memory size
}

Expand Down

0 comments on commit 54922aa

Please sign in to comment.