[PATCH] fs: ramfs: get chunks zero initialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Initialize new chunks to zero, otherwise a ->truncate call may
result in uninitialized data in files.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 fs/ramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ramfs.c b/fs/ramfs.c
index a97f0a6ebf..7af885b324 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -140,7 +140,7 @@ static struct ramfs_chunk *ramfs_get_chunk(void)
 	if (!data)
 		return NULL;
 
-	data->data = malloc(CHUNK_SIZE);
+	data->data = calloc(CHUNK_SIZE, 1);
 	if (!data->data) {
 		free(data);
 		return NULL;
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux