mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-22 06:07:36 +02:00
spiFlash: fix overflow test (#172)
This commit is contained in:
+1
-1
@@ -258,7 +258,7 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
|
||||
/* if known chip */
|
||||
if (_flash_model) {
|
||||
/* check if offset + len fit in flash */
|
||||
if ((unsigned int)(base_addr + len) > (_flash_model->nr_sector * 0x10000) - 1) {
|
||||
if ((unsigned int)(base_addr + len) > (_flash_model->nr_sector * 0x10000)) {
|
||||
printError("flash overflow");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user