Always zero rambd buffer before first use

This fixes warnings produced by tools such as memcheck without
requiring the user to set an erase value.
This commit is contained in:
Tobias Nießen
2021-11-14 16:10:54 +01:00
committed by GitHub
parent ead50807f1
commit fdda3b4aa2

View File

@@ -36,6 +36,8 @@ int lfs_rambd_createcfg(const struct lfs_config *cfg,
if (bd->cfg->erase_value != -1) { if (bd->cfg->erase_value != -1) {
memset(bd->buffer, bd->cfg->erase_value, memset(bd->buffer, bd->cfg->erase_value,
cfg->block_size * cfg->block_count); cfg->block_size * cfg->block_count);
} else {
memset(bd->buffer, 0, cfg->block_size * cfg->block_count);
} }
LFS_RAMBD_TRACE("lfs_rambd_createcfg -> %d", 0); LFS_RAMBD_TRACE("lfs_rambd_createcfg -> %d", 0);