diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c index 92e7dc3bbe..31635b123b 100644 --- a/fs/binfs/fs_binfs.c +++ b/fs/binfs/fs_binfs.c @@ -449,7 +449,6 @@ static int binfs_statfs(struct inode *mountpt, struct statfs *buf) /* Fill in the statfs info */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = BINFS_MAGIC; buf->f_bsize = 0; buf->f_blocks = 0; diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c index a36be7783c..03e60a9470 100644 --- a/fs/cromfs/fs_cromfs.c +++ b/fs/cromfs/fs_cromfs.c @@ -1467,7 +1467,6 @@ static int cromfs_statfs(struct inode *mountpt, struct statfs *buf) /* Fill in the statfs info. */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = CROMFS_MAGIC; buf->f_namelen = NAME_MAX; buf->f_bsize = fs->cv_bsize; diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c index ae182fed7a..7f30d6d570 100644 --- a/fs/fat/fs_fat32.c +++ b/fs/fat/fs_fat32.c @@ -2333,7 +2333,6 @@ static int fat_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Fill in the statfs info */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = MSDOS_SUPER_MAGIC; /* We will claim that the optimal transfer size is the size of a cluster diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index f7c4a70886..43da3eb4a2 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -1161,7 +1161,6 @@ static int hostfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Call the host fs to perform the statfs */ - memset(buf, 0, sizeof(struct statfs)); ret = host_statfs(fs->fs_root, buf); buf->f_type = HOSTFS_MAGIC; diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c index d245d4b5e5..332d3da59c 100644 --- a/fs/littlefs/lfs_vfs.c +++ b/fs/littlefs/lfs_vfs.c @@ -1242,7 +1242,6 @@ static int littlefs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Return something for the file system description */ - memset(buf, 0, sizeof(*buf)); buf->f_type = LITTLEFS_SUPER_MAGIC; buf->f_namelen = LFS_NAME_MAX; buf->f_bsize = fs->cfg.block_size; diff --git a/fs/mount/fs_foreachmountpoint.c b/fs/mount/fs_foreachmountpoint.c index 2508d498ea..7214228bc0 100644 --- a/fs/mount/fs_foreachmountpoint.c +++ b/fs/mount/fs_foreachmountpoint.c @@ -100,6 +100,7 @@ static int mountpoint_filter(FAR struct inode *node, /* Get the status of the file system */ + memset(&statbuf, 0, sizeof(struct statfs)); if (node->u.i_mops->statfs(node, &statbuf) == OK) { /* And pass the full path and file system status to the handler */ diff --git a/fs/nxffs/nxffs_stat.c b/fs/nxffs/nxffs_stat.c index d6cce51b52..1cd5ea453e 100644 --- a/fs/nxffs/nxffs_stat.c +++ b/fs/nxffs/nxffs_stat.c @@ -74,7 +74,6 @@ int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) * REVISIT: Need f_bfree, f_bavail, f_files, f_ffree calculation */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = NXFFS_MAGIC; buf->f_bsize = volume->geo.blocksize; buf->f_blocks = volume->nblocks; diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 5065108904..be5bd26078 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -1005,7 +1005,6 @@ static int procfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) { /* Fill in the statfs info */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = PROCFS_MAGIC; buf->f_bsize = 0; buf->f_blocks = 0; diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index eda870dc04..bd1bc2f03a 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -1260,7 +1260,6 @@ static int romfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Fill in the statfs info */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = ROMFS_MAGIC; /* We will claim that the optimal transfer size is the size of one sector */ diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index d46a2c0e84..96f26d27fb 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -1234,7 +1234,6 @@ static int rpmsgfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Call the host fs to perform the statfs */ - memset(buf, 0, sizeof(struct statfs)); ret = rpmsgfs_client_statfs(fs->handle, fs->fs_root, buf); buf->f_type = RPMSGFS_MAGIC; diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index 3c6ea1fad4..c65ce85d3b 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -1610,7 +1610,6 @@ static int smartfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) /* Implement the logic!! */ - memset(buf, 0, sizeof(struct statfs)); buf->f_type = SMARTFS_MAGIC; /* Re-request the low-level format info to update free blocks */ diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index a7ab19002e..d6c732e021 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -2045,8 +2045,6 @@ static int unionfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL && buf != NULL); ui = (FAR struct unionfs_inode_s *)mountpt->i_private; - memset(buf, 0, sizeof(struct statfs)); - /* Get statfs info from file system 1. * * REVISIT: What would it mean if one file system did not support statfs? @@ -2064,6 +2062,8 @@ static int unionfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) um2->um_node->u.i_mops != NULL); ops2 = um2->um_node->u.i_mops; + memset(&buf1, 0, sizeof(struct statfs)); + memset(&buf2, 0, sizeof(struct statfs)); if (ops1->statfs != NULL && ops2->statfs != NULL) { ret = ops1->statfs(um1->um_node, &buf1); diff --git a/fs/vfs/fs_fstatfs.c b/fs/vfs/fs_fstatfs.c index d5b31ac400..ce010110cc 100644 --- a/fs/vfs/fs_fstatfs.c +++ b/fs/vfs/fs_fstatfs.c @@ -104,6 +104,7 @@ int fstatfs(int fd, FAR struct statfs *buf) { /* Perform the statfs() operation */ + memset(buf, 0, sizeof(struct statfs)); ret = inode->u.i_mops->statfs(inode, buf); } } diff --git a/fs/vfs/fs_statfs.c b/fs/vfs/fs_statfs.c index 1d6050c2f7..ae08d1a2ae 100644 --- a/fs/vfs/fs_statfs.c +++ b/fs/vfs/fs_statfs.c @@ -43,7 +43,6 @@ static int statpseudofs(FAR struct inode *inode, FAR struct statfs *buf) { - memset(buf, 0, sizeof(struct statfs)); buf->f_type = PROC_SUPER_MAGIC; buf->f_namelen = NAME_MAX; return OK; @@ -113,6 +112,7 @@ int statfs(FAR const char *path, FAR struct statfs *buf) * are dealing with. */ + memset(buf, 0, sizeof(struct statfs)); #ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode)) { diff --git a/libs/libc/userfs/lib_userfs.c b/libs/libc/userfs/lib_userfs.c index 3a73670cc5..6ff6d6c83c 100644 --- a/libs/libc/userfs/lib_userfs.c +++ b/libs/libc/userfs/lib_userfs.c @@ -588,6 +588,7 @@ static inline int userfs_statfs_dispatch(FAR struct userfs_info_s *info, /* Dispatch the request */ DEBUGASSERT(info->userops != NULL && info->userops->statfs != NULL); + memset(&resp.buf, 0, sizeof(struct statfs)); resp.ret = info->userops->statfs(info->volinfo, &resp.buf); /* Send the response */