diff options
author | jhb <jhb@FreeBSD.org> | 2002-04-03 18:35:25 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-04-03 18:35:25 +0000 |
commit | 9fa365d7d67c21097e519ca5c812844138eb8557 (patch) | |
tree | c4e6823f0ea6ef8827c9bac0352a195e9c8408fc /sys/kern/kern_prot.c | |
parent | ff56a14aba6d120db325bc616fa934ad1a5e85f4 (diff) | |
download | FreeBSD-src-9fa365d7d67c21097e519ca5c812844138eb8557.zip FreeBSD-src-9fa365d7d67c21097e519ca5c812844138eb8557.tar.gz |
- Axe a stale comment. We haven't allowed the ucred pointer passed to
securelevel_*() to be NULL for a while now.
- Use KASSERT() instead of if (foo) panic(); to optimize the
!INVARIANTS case.
Submitted by: Martin Faxer <gmh003532@brfmasthugget.se>
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r-- | sys/kern/kern_prot.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 3ba42b1..578770e 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1242,11 +1242,6 @@ suser(struct thread *td) * (securelevel >= level). Note that the logic is inverted -- these * functions return EPERM on "success" and 0 on "failure". * - * cr is permitted to be NULL for the time being, as there were some - * existing securelevel checks that occurred without a process/credential - * context. In the future this will be disallowed, so a kernel message - * is displayed. - * * MPSAFE */ int @@ -1255,8 +1250,7 @@ securelevel_gt(struct ucred *cr, int level) int active_securelevel; active_securelevel = securelevel; - if (cr == NULL) - panic("securelevel_gt: cr is NULL\n"); + KASSERT(cr != NULL, ("securelevel_gt: null cr")); if (cr->cr_prison != NULL) { mtx_lock(&cr->cr_prison->pr_mtx); active_securelevel = imax(cr->cr_prison->pr_securelevel, @@ -1272,8 +1266,7 @@ securelevel_ge(struct ucred *cr, int level) int active_securelevel; active_securelevel = securelevel; - if (cr == NULL) - panic("securelevel_gt: cr is NULL\n"); + KASSERT(cr != NULL, ("securelevel_ge: null cr")); if (cr->cr_prison != NULL) { mtx_lock(&cr->cr_prison->pr_mtx); active_securelevel = imax(cr->cr_prison->pr_securelevel, |