From d870f4ab29529291d2ccfbf95bddb0458bc12350 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 1 Nov 2016 22:27:35 +0000 Subject: [PATCH] I think, that Size is (highest address+1 - Base address) Base address has been removed and if address+count >= size we are outside of the Flash --- arch/arm/src/stm32/stm32_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/src/stm32/stm32_flash.c b/arch/arm/src/stm32/stm32_flash.c index 73f1419506..56aa1f75ed 100644 --- a/arch/arm/src/stm32/stm32_flash.c +++ b/arch/arm/src/stm32/stm32_flash.c @@ -313,7 +313,7 @@ ssize_t up_progmem_write(size_t addr, const void *buf, size_t count) addr -= STM32_FLASH_BASE; } - if ((addr+count) > STM32_FLASH_SIZE) + if ((addr+count) >= STM32_FLASH_SIZE) { return -EFAULT; }