From 66117097c47519eb6f4e66d88b481216a505deef Mon Sep 17 00:00:00 2001 From: David Saada Date: Wed, 2 Jan 2019 22:32:47 +0200 Subject: [PATCH] TDBStore: fix bug in sector blank check for variant sized sectors --- features/storage/kvstore/tdbstore/TDBStore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/storage/kvstore/tdbstore/TDBStore.cpp b/features/storage/kvstore/tdbstore/TDBStore.cpp index 9ba1fd4130..c12b15e09b 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.cpp +++ b/features/storage/kvstore/tdbstore/TDBStore.cpp @@ -1409,7 +1409,7 @@ void TDBStore::offset_in_erase_unit(uint8_t area, uint32_t offset, } uint32_t agg_offset = 0; - while (bd_offset < agg_offset + _buff_bd->get_erase_size(agg_offset)) { + while (bd_offset >= agg_offset + _buff_bd->get_erase_size(agg_offset)) { agg_offset += _buff_bd->get_erase_size(agg_offset); } offset_from_start = bd_offset - agg_offset;