[PATCH] f2fs-tools: initialize user cache valid values

From: Daeho Jeong
Date: Thu Nov 09 2023 - 16:33:56 EST


From: Daeho Jeong <daehojeong@xxxxxxxxxx>

Need to initialize user cache valid values to prevent from providing
false cache entries.

Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
---
lib/libf2fs_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 39d3777..d76da83 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -165,7 +165,7 @@ static int dcache_alloc_all(long n)
|| (dcache_lastused = (uint64_t *)
malloc(sizeof(uint64_t) * n)) == NULL
|| (dcache_buf = (char *) malloc (F2FS_BLKSIZE * n)) == NULL
- || (dcache_valid = (bool *) malloc(sizeof(bool) * n)) == NULL)
+ || (dcache_valid = (bool *) calloc(sizeof(bool) * n, 1)) == NULL)
{
dcache_release();
return -1;
--
2.42.0.869.gea05f2083d-goog