Explicitly check if 'fd' is less than 0 instead of using cast-to-unsinged hack.

MFC after:	1 month
This commit is contained in:
Pawel Jakub Dawidek 2012-06-14 15:23:51 +00:00
parent eb273c01f3
commit ee142bc754

View File

@ -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 */