diff options
author | jamie <jamie@FreeBSD.org> | 2009-05-23 16:13:26 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-05-23 16:13:26 +0000 |
commit | e446b3e48f60014d843785a627db61914fd2bcd2 (patch) | |
tree | ce0b045766f42042696c6ee3f803a023a2b71d39 /sys/kern/kern_jail.c | |
parent | f354c73971bbeea9f1eb6863466272ada887e96a (diff) | |
download | FreeBSD-src-e446b3e48f60014d843785a627db61914fd2bcd2.zip FreeBSD-src-e446b3e48f60014d843785a627db61914fd2bcd2.tar.gz |
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)
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r-- | sys/kern/kern_jail.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 3bc5c10..d0cc440 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1196,14 +1196,6 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) 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 uio *optuio, int flags) 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. */ |