[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH] lib/ramfs: initialize memory during expanding files
Malloc was used for expanding ramfs buffers during writes, which does not have to allocate zeroed memory. This means that in case of writing with offset (e.g. pwrite), the gap between last written data and new data will be filled with random data. Just use calloc. Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- lib/ramfs/ramfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ramfs/ramfs_vnops.c b/lib/ramfs/ramfs_vnops.c index 95d6d35b..f0848bd0 100644 --- a/lib/ramfs/ramfs_vnops.c +++ b/lib/ramfs/ramfs_vnops.c @@ -470,7 +470,7 @@ ramfs_write(struct vnode *vp, struct uio *uio, int ioflag) if (end_pos > (off_t) np->rn_bufsize) { // XXX: this could use a page level allocator size_t new_size = round_pgup(end_pos); - void *new_buf = malloc(new_size); + void *new_buf = calloc(1, new_size); if (!new_buf) return EIO; -- 2.19.2 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |