This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 987b01221c fs/rpmsgfs: Zero dirs after realloc to avoid stale data
987b01221c is described below

commit 987b01221cb0f22abc8f96258b604ce54c1a4e24
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun Jun 25 03:56:35 2023 +0800

    fs/rpmsgfs: Zero dirs after realloc to avoid stale data
    
    since many places assume the null pointer as an unused entry
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 fs/rpmsgfs/rpmsgfs_server.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/rpmsgfs/rpmsgfs_server.c b/fs/rpmsgfs/rpmsgfs_server.c
index 672c579a69..00cd0636e5 100644
--- a/fs/rpmsgfs/rpmsgfs_server.c
+++ b/fs/rpmsgfs/rpmsgfs_server.c
@@ -285,6 +285,9 @@ static int rpmsgfs_attach_dir(FAR struct rpmsgfs_server_s 
*priv,
       return -ENOMEM;
     }
 
+  memset(&tmp[priv->dir_nums], 0, sizeof(FAR void *) *
+         CONFIG_NFILE_DESCRIPTORS_PER_BLOCK);
+
   priv->dirs = tmp;
   priv->dir_nums += CONFIG_NFILE_DESCRIPTORS_PER_BLOCK;
 

Reply via email to