Explorar el Código

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 hace 4 años
padre
commit
fdda3b4aa2
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  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);