Skip to content

Zero initialise all NVStore&kvstore members #11179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/storage/kvstore/kv_map/KVMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,5 +332,5 @@ FileSystem *KVMap::get_external_filesystem_instance(const char *name)
return ret != MBED_SUCCESS ? NULL : kv_config->external_fs;
}

}
} // namespace mbed

4 changes: 3 additions & 1 deletion features/storage/kvstore/tdbstore/TDBStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static uint32_t calc_crc(uint32_t init_crc, uint32_t data_size, const void *data
TDBStore::TDBStore(BlockDevice *bd) : _ram_table(0), _max_keys(0),
_num_keys(0), _bd(bd), _buff_bd(0), _free_space_offset(0), _master_record_offset(0),
_master_record_size(0), _is_initialized(false), _active_area(0), _active_area_version(0), _size(0),
_prog_size(0), _work_buf(0), _key_buf(0), _variant_bd_erase_unit_size(false), _inc_set_handle(0)
_area_params{}, _prog_size(0), _work_buf(0), _key_buf(0), _variant_bd_erase_unit_size(false), _inc_set_handle(0)
{
for (int i = 0; i < _num_areas; i++) {
_area_params[i] = { 0 };
Expand Down Expand Up @@ -419,6 +419,8 @@ int TDBStore::set_start(set_handle_t *handle, const char *key, size_t final_data
// in the upper layers).
ih->bd_base_offset = _master_record_offset;
ih->new_key = false;
ram_table_ind = 0;
hash = 0;
} else {

_mutex.lock();
Expand Down
4 changes: 2 additions & 2 deletions features/storage/nvstore/source/nvstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ static uint32_t crc32(uint32_t init_crc, uint32_t data_size, uint8_t *data_buf)
}

NVStore::NVStore() : _init_done(0), _init_attempts(0), _active_area(0), _max_keys(NVSTORE_MAX_KEYS),
_active_area_version(0), _free_space_offset(0), _size(0), _mutex(0), _offset_by_key(0), _flash(0),
_min_prog_size(0), _page_buf(0)
_active_area_version(0), _free_space_offset(0), _size(0), _mutex(0), _offset_by_key(0), _flash_area_params{},
_flash(0), _min_prog_size(0), _page_buf(0)
{
for (int i = 0; i < NVSTORE_NUM_AREAS; i++) {
_flash_area_params[i] = { 0 };
Expand Down