svn commit: r339821 - stable/11/sys/sys

Dag-Erling Smørgrav des at FreeBSD.org
Sat Oct 27 19:08:07 UTC 2018


Author: des
Date: Sat Oct 27 19:08:06 2018
New Revision: 339821
URL: https://svnweb.freebsd.org/changeset/base/339821

Log:
  MFH (r305124): fix case where fd_lastfile is -1.

Modified:
  stable/11/sys/sys/filedesc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/filedesc.h
==============================================================================
--- stable/11/sys/sys/filedesc.h	Sat Oct 27 18:48:49 2018	(r339820)
+++ stable/11/sys/sys/filedesc.h	Sat Oct 27 19:08:06 2018	(r339821)
@@ -219,7 +219,7 @@ fdeget_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);
 
 	fde = &fdp->fd_ofiles[fd];


More information about the svn-src-all mailing list