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 <petro.karashchenko@gmail.com>
This commit is contained in:
parent
127a3585cc
commit
08f5a5a3be
@ -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)
|
for (entry = g_procfs_meminfo; entry != NULL; entry = entry->next)
|
||||||
{
|
{
|
||||||
if (totalsize < buflen)
|
if (buflen > 0)
|
||||||
{
|
{
|
||||||
struct mallinfo minfo;
|
struct mallinfo minfo;
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MM_PGALLOC
|
#ifdef CONFIG_MM_PGALLOC
|
||||||
if (totalsize < buflen)
|
if (buflen > 0)
|
||||||
{
|
{
|
||||||
struct pginfo_s pginfo;
|
struct pginfo_s pginfo;
|
||||||
unsigned long total;
|
unsigned long total;
|
||||||
@ -359,7 +359,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_HAVE_PROGMEM) && defined(CONFIG_FS_PROCFS_INCLUDE_PROGMEM)
|
#if defined(CONFIG_ARCH_HAVE_PROGMEM) && defined(CONFIG_FS_PROCFS_INCLUDE_PROGMEM)
|
||||||
if (totalsize < buflen)
|
if (buflen > 0)
|
||||||
{
|
{
|
||||||
struct progmem_info_s progmem;
|
struct progmem_info_s progmem;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user