You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/28 17:30:02 UTC

[nuttx] branch master updated: meminfo: buflen identify the left of buffer

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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 08f5a5a3be meminfo: buflen identify the left of buffer
08f5a5a3be is described below

commit 08f5a5a3be2e8a9d1df0890d6f1a575a18b744b9
Author: Gao Feng <Fe...@sony.com>
AuthorDate: Mon Nov 28 22:41:41 2022 +0800

    meminfo: buflen identify the left of buffer
    
    It is enought to only checking the buflen's avaiable or not.
    (total size means total copied size)
    
    Co-authored-by: Petro Karashchenko <pe...@gmail.com>
---
 fs/procfs/fs_procfsmeminfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c
index 49d55ea795..fa847657cb 100644
--- a/fs/procfs/fs_procfsmeminfo.c
+++ b/fs/procfs/fs_procfsmeminfo.c
@@ -302,7 +302,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
 
   for (entry = g_procfs_meminfo; entry != NULL; entry = entry->next)
     {
-      if (totalsize < buflen)
+      if (buflen > 0)
         {
           struct mallinfo minfo;
 
@@ -328,7 +328,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
     }
 
 #ifdef CONFIG_MM_PGALLOC
-  if (totalsize < buflen)
+  if (buflen > 0)
     {
       struct pginfo_s pginfo;
       unsigned long total;
@@ -359,7 +359,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
 #endif
 
 #if defined(CONFIG_ARCH_HAVE_PROGMEM) && defined(CONFIG_FS_PROCFS_INCLUDE_PROGMEM)
-  if (totalsize < buflen)
+  if (buflen > 0)
     {
       struct progmem_info_s progmem;