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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0a111b7  fs/rpmsgfs: fix bug about using uninit variable "times"
0a111b7 is described below

commit 0a111b7c9654a128f6665c8e197d54663c743a77
Author: Jiuzhu Dong <dongjiuz...@xiaomi.com>
AuthorDate: Fri Apr 1 10:42:28 2022 +0800

    fs/rpmsgfs: fix bug about using uninit variable "times"
    
    Signed-off-by: Jiuzhu Dong <dongjiuz...@xiaomi.com>
---
 arch/sim/src/sim/up_hostfs.c | 4 ++++
 fs/rpmsgfs/rpmsgfs_server.c  | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/arch/sim/src/sim/up_hostfs.c b/arch/sim/src/sim/up_hostfs.c
index 828f7e9..151799e 100644
--- a/arch/sim/src/sim/up_hostfs.c
+++ b/arch/sim/src/sim/up_hostfs.c
@@ -348,6 +348,7 @@ int host_fchstat(int fd, const struct nuttx_stat_s *buf, 
int flags)
         }
       else
         {
+          times[0].tv_sec = 0;
           times[0].tv_nsec = UTIME_OMIT;
         }
 
@@ -358,6 +359,7 @@ int host_fchstat(int fd, const struct nuttx_stat_s *buf, 
int flags)
         }
       else
         {
+          times[1].tv_sec = 0;
           times[1].tv_nsec = UTIME_OMIT;
         }
 
@@ -634,6 +636,7 @@ int host_chstat(const char *path, const struct nuttx_stat_s 
*buf, int flags)
         }
       else
         {
+          times[0].tv_sec = 0;
           times[0].tv_nsec = UTIME_OMIT;
         }
 
@@ -644,6 +647,7 @@ int host_chstat(const char *path, const struct nuttx_stat_s 
*buf, int flags)
         }
       else
         {
+          times[1].tv_sec = 0;
           times[1].tv_nsec = UTIME_OMIT;
         }
 
diff --git a/fs/rpmsgfs/rpmsgfs_server.c b/fs/rpmsgfs/rpmsgfs_server.c
index 41b7984..6698be3 100644
--- a/fs/rpmsgfs/rpmsgfs_server.c
+++ b/fs/rpmsgfs/rpmsgfs_server.c
@@ -769,6 +769,7 @@ static int rpmsgfs_chstat_handler(FAR struct rpmsg_endpoint 
*ept,
         }
       else
         {
+          times[0].tv_sec = 0;
           times[0].tv_nsec = UTIME_OMIT;
         }
 
@@ -778,6 +779,7 @@ static int rpmsgfs_chstat_handler(FAR struct rpmsg_endpoint 
*ept,
         }
       else
         {
+          times[1].tv_sec = 0;
           times[1].tv_nsec = UTIME_OMIT;
         }
 

Reply via email to