svn commit: r192644 - head/sys/kern

Jamie Gritton jamie at FreeBSD.org
Sat May 23 16:13:27 UTC 2009


Author: jamie
Date: Sat May 23 16:13:26 2009
New Revision: 192644
URL: http://svn.freebsd.org/changeset/base/192644

Log:
  Delay an error message until the variable it uses gets initialized.
  
  Found with:	Coverity Prevent(tm)
  CID:		4316
  Reported by:	trasz
  Approved by:	bz (mentor)

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Sat May 23 16:11:36 2009	(r192643)
+++ head/sys/kern/kern_jail.c	Sat May 23 16:13:26 2009	(r192644)
@@ -1196,14 +1196,6 @@ kern_jail_get(struct thread *td, struct 
 
 	if (flags & ~JAIL_GET_MASK)
 		return (EINVAL);
-	if (jailed(td->td_ucred)) {
-		/*
-		 * Don't allow a jailed process to see any jails,
-		 * not even its own.
-		 */
-		vfs_opterror(opts, "jail not found");
-		return (ENOENT);
-	}
 
 	/* Get the parameter list. */
 	error = vfs_buildopts(optuio, &opts);
@@ -1211,6 +1203,12 @@ kern_jail_get(struct thread *td, struct 
 		return (error);
 	errmsg_pos = vfs_getopt_pos(opts, "errmsg");
 
+	/* Don't allow a jailed process to see any jails, not even its own. */
+	if (jailed(td->td_ucred)) {
+		vfs_opterror(opts, "jail not found");
+		return (ENOENT);
+	}
+
 	/*
 	 * Find the prison specified by one of: lastjid, jid, name.
 	 */


More information about the svn-src-all mailing list