Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2012 16:24:03 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237081 - head/sys/sys
Message-ID:  <201206141624.q5EGO3Do005355@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Thu Jun 14 16:24:03 2012
New Revision: 237081
URL: http://svn.freebsd.org/changeset/base/237081

Log:
  Explicitly assert that the filedesc lock is held when the fget_locked()
  function is called.
  
  MFC after:	1 month

Modified:
  head/sys/sys/filedesc.h

Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h	Thu Jun 14 16:23:16 2012	(r237080)
+++ head/sys/sys/filedesc.h	Thu Jun 14 16:24:03 2012	(r237081)
@@ -142,7 +142,12 @@ static __inline struct file *
 fget_locked(struct filedesc *fdp, int fd)
 {
 
-	return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
+	FILEDESC_LOCK_ASSERT(fdp);
+
+	if (fd < 0 || fd >= fdp->fd_nfiles)
+		return (NULL);
+
+	return (fdp->fd_ofiles[fd]);
 }
 
 #endif /* _KERNEL */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206141624.q5EGO3Do005355>