xiaoxiang781216 commented on code in PR #7319:
URL: https://github.com/apache/incubator-nuttx/pull/7319#discussion_r996433261


##########
fs/procfs/fs_procfs.c:
##########
@@ -184,27 +184,24 @@ static const struct procfs_entry_s g_procfs_entries[] =
 #if defined(CONFIG_DEBUG_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
   { "tcbinfo",       &tcbinfo_operations,         PROCFS_FILE_TYPE   },
 #endif
+  { NULL,            NULL,                        PROCFS_UNKOWN_TYPE },
 };
 
 #ifdef CONFIG_FS_PROCFS_REGISTER
 static const uint8_t g_base_entrycount = sizeof(g_base_entries) /

Review Comment:
   Adding NULL entry avoid the out of boundary error:
   ```
   procfs/fs_procfs.c: In function 'procfs_readdir':
   Error: procfs/fs_procfs.c:878:35: error: array subscript <unknown> is 
outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
     878 |       if (strncmp(g_procfs_entries[level1->base.index].pathpattern,
   ```
   Many place verify the index in the range, the code has to recompute the 
count every time if we remove `g_base_entrycount`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to