svn commit: r237071 - head/sys/sys
Pawel Jakub Dawidek
pjd at FreeBSD.org
Thu Jun 14 15:23:52 UTC 2012
Author: pjd
Date: Thu Jun 14 15:23:51 2012
New Revision: 237071
URL: http://svn.freebsd.org/changeset/base/237071
Log:
Explicitly check if 'fd' is less than 0 instead of using cast-to-unsinged hack.
MFC after: 1 month
Modified:
head/sys/sys/filedesc.h
Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h Thu Jun 14 15:21:57 2012 (r237070)
+++ head/sys/sys/filedesc.h Thu Jun 14 15:23:51 2012 (r237071)
@@ -141,7 +141,7 @@ static __inline struct file *
fget_locked(struct filedesc *fdp, int fd)
{
- return ((unsigned int)fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
+ return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
}
#endif /* _KERNEL */
More information about the svn-src-all
mailing list