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 2023/01/20 12:11:23 UTC

[GitHub] [nuttx] acassis commented on a diff in pull request #8194: fs: Avoid accessing filep fields if it is NULL & add DEBUGASSERTs

acassis commented on code in PR #8194:
URL: https://github.com/apache/nuttx/pull/8194#discussion_r1082431352


##########
fs/inode/fs_files.c:
##########
@@ -298,7 +301,10 @@ int files_duplist(FAR struct filelist *plist, FAR struct filelist *clist)
 #endif
 
           filep = &plist->fl_files[i][j];
-          if (filep->f_inode == NULL || (filep->f_oflags & O_CLOEXEC) != 0)
+          DEBUGASSERT(filep);
+
+          if (filep && (filep->f_inode == NULL ||
+                       (filep->f_oflags & O_CLOEXEC) != 0))

Review Comment:
   Actually the original fix as only that "if (filep && (...))", I added the DEBUGASSET later because it will avoid some silent issue that could happen in some cases.



-- 
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