From b6fc58b743326633e56c1c86c84cced9baf9a2f4 Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Tue, 6 Jun 2017 20:43:59 +1000 Subject: [PATCH] spi_write: use uint32_t for the page iteration counter. The page counter was using an uint8_t which seems unnecessary and might wrap. --- core/spiflash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/spiflash.c b/core/spiflash.c index 386d7c9..764db11 100644 --- a/core/spiflash.c +++ b/core/spiflash.c @@ -133,7 +133,7 @@ static bool IRAM spi_write(uint32_t addr, uint8_t *dst, uint32_t size) uint32_t offset = write_bytes_to_page; uint32_t pages_to_write = (size - offset) / sdk_flashchip.page_size; - for (uint8_t i = 0; i != pages_to_write; i++) { + for (uint32_t i = 0; i < pages_to_write; i++) { if (!spi_write_page(&sdk_flashchip, addr + offset, dst + offset, sdk_flashchip.page_size)) { return false;