From cbbf61af932ae27308f9f43e126ca25808cff31c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 30 Jan 2020 17:09:29 +1100 Subject: [PATCH] HAL_Linux: fixed bitmask error on storage erase --- libraries/AP_HAL_Linux/Storage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_Linux/Storage.cpp b/libraries/AP_HAL_Linux/Storage.cpp index 67b79f2f77..9d779051cd 100644 --- a/libraries/AP_HAL_Linux/Storage.cpp +++ b/libraries/AP_HAL_Linux/Storage.cpp @@ -183,7 +183,10 @@ void Storage::init() */ 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 (uint8_t line=loc>>LINUX_STORAGE_LINE_SHIFT; line <= end>>LINUX_STORAGE_LINE_SHIFT; line++) {