Author: mjg Date: Wed Aug 31 12:29:04 2016 New Revision: 305124 URL: https://svnweb.freebsd.org/changeset/base/305124
Log: fd: effectively revert r305091 Turns out fd_lastfile can survive being -1 for some processes, giving incorrect results with the cast. Noted by: cem Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Wed Aug 31 11:55:31 2016 (r305123) +++ head/sys/sys/filedesc.h Wed Aug 31 12:29:04 2016 (r305124) @@ -201,7 +201,7 @@ fget_locked(struct filedesc *fdp, int fd FILEDESC_LOCK_ASSERT(fdp); - if ((u_int)fd > fdp->fd_lastfile) + if (fd < 0 || fd > fdp->fd_lastfile) return (NULL); return (fdp->fd_ofiles[fd].fde_file); @@ -213,7 +213,7 @@ fdeget_locked(struct filedesc *fdp, int FILEDESC_LOCK_ASSERT(fdp); - if ((u_int)fd > fdp->fd_lastfile) + if (fd < 0 || fd > fdp->fd_lastfile) return (NULL); return (&fdp->fd_ofiles[fd]); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"