You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/04/19 07:47:35 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6100: fs/inode/fs_files:changes fd judgment method

pkarashchenko commented on code in PR #6100:
URL: https://github.com/apache/incubator-nuttx/pull/6100#discussion_r852703721


##########
fs/inode/fs_files.c:
##########
@@ -361,7 +361,9 @@ int fs_getfilep(int fd, FAR struct file **filep)
       return -EAGAIN;
     }
 
-  if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS_PER_BLOCK * list->fl_rows)
+  if (fd < 0 || fd >= list->fl_rows * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK ||

Review Comment:
   I suggest to `ret = _files_semtake(list);` before accessing `fl_files[][].f_inode`



-- 
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-unsubscribe@nuttx.apache.org

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