Sfoglia il codice sorgente

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.
Tobias Nießen 4 anni fa
parent
commit
fdda3b4aa2
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      bd/lfs_rambd.c

+ 2 - 0
bd/lfs_rambd.c

@@ -36,6 +36,8 @@ int lfs_rambd_createcfg(const struct lfs_config *cfg,
     if (bd->cfg->erase_value != -1) {
         memset(bd->buffer, bd->cfg->erase_value,
                 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);