Skip to contentSkip to conversation

f2fs-tools: initialize user cache valid values

PATCH New Daeho Jeong 1 participant 1 message Nov 9, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: initialize user cache valid values

From: Daeho Jeong <[email protected]>

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

---
 lib/libf2fs_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/libf2fs_io.c +1 -1
index 39d3777..d76da83 100644
@@ -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;
Signature · 1 line
2.42.0.869.gea05f2083d-goog