Skip to content

Commit 458f5f4

Browse files
author
Veijo Pesonen
committed
TDBStore: Adds sanity check for storage size when compiled with debug profile
1 parent f51cc64 commit 458f5f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

features/storage/kvstore/tdbstore/TDBStore.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ TDBStore::TDBStore(BlockDevice *bd) : _ram_table(0), _max_keys(0),
134134
for (int i = 0; i < _max_open_iterators; i++) {
135135
_iterator_table[i] = { 0 };
136136
}
137+
138+
/* Minimum space required by Reserved area and master record */
139+
MBED_ASSERT(bd->size()
140+
>= (align_up(RESERVED_AREA_SIZE + sizeof(reserved_trailer_t), _prog_size)
141+
+ record_size(master_rec_key, sizeof(master_record_data_t))));
137142
}
138143

139144
TDBStore::~TDBStore()

0 commit comments

Comments
 (0)