From fbf68c860b190c04c0e906272041c0cfc9bad560 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 30 Jan 2020 17:09:29 +1100 Subject: [PATCH] HAL_SITL: fixed bitmask error on storage erase --- libraries/AP_HAL_SITL/Storage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_SITL/Storage.cpp b/libraries/AP_HAL_SITL/Storage.cpp index 50131c9a97..2ce4d4af1f 100644 --- a/libraries/AP_HAL_SITL/Storage.cpp +++ b/libraries/AP_HAL_SITL/Storage.cpp @@ -69,7 +69,10 @@ void Storage::_storage_open(void) */ void Storage::_mark_dirty(uint16_t loc, uint16_t length) { - uint16_t end = loc + length; + if (length == 0) { + return; + } + uint16_t end = loc + length - 1; for (uint16_t line=loc>>STORAGE_LINE_SHIFT; line <= end>>STORAGE_LINE_SHIFT; line++) {