You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/12/11 09:36:09 UTC

(nuttx) branch master updated: procfs/cpuinfo: Zero copylen in cpuinfo_read

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

pkarashchenko 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 19baa56fb5 procfs/cpuinfo: Zero copylen in cpuinfo_read
19baa56fb5 is described below

commit 19baa56fb53bb3de12e0a022d74a32b8bc8de6b7
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Dec 10 10:56:12 2023 +0800

    procfs/cpuinfo: Zero copylen in cpuinfo_read
    
    to avoid return the negative number
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 fs/procfs/fs_procfscpuinfo.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/procfs/fs_procfscpuinfo.c b/fs/procfs/fs_procfscpuinfo.c
index 73f7ffb40d..c818dd6284 100644
--- a/fs/procfs/fs_procfscpuinfo.c
+++ b/fs/procfs/fs_procfscpuinfo.c
@@ -157,6 +157,10 @@ static ssize_t cpuinfo_read(FAR struct file *filep, FAR char *buffer,
     {
       filep->f_pos += copylen;
     }
+  else
+    {
+      copylen = 0;
+    }
 
   return copylen;
 }