diff mbox series

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

Message ID 20231109213348.675704-1-daeho43@gmail.com (mailing list archive)
State New
Headers show
Series [f2fs-dev] f2fs-tools: initialize user cache valid values | expand

Commit Message

Daeho Jeong Nov. 9, 2023, 9:33 p.m. UTC
From: Daeho Jeong <daehojeong@google.com>

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

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

Patch

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;