The branch stable/15 has been updated by jamie:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0c23ee96c6e5f591182ad6bf314f59e7701c8f0a

commit 0c23ee96c6e5f591182ad6bf314f59e7701c8f0a
Author:     Jamie Gritton <ja...@freebsd.org>
AuthorDate: 2025-09-09 18:46:45 +0000
Commit:     Jamie Gritton <ja...@freebsd.org>
CommitDate: 2025-09-13 22:37:56 +0000

    MFC jaildesc: fix typo and style(9) violations.
    
    Reported by:    kib
    MFC after:      3 days
    
    (cherry picked from commit d8d5324ef5335dd9404db7263be2271610245e10)
---
 lib/libjail/jail.c       | 16 ++++++++--------
 sys/kern/kern_jail.c     | 36 ++++++++++++++++++------------------
 sys/kern/kern_jaildesc.c | 26 +++++++++++++-------------
 3 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c
index 931391055919..f761bc6993e5 100644
--- a/lib/libjail/jail.c
+++ b/lib/libjail/jail.c
@@ -95,8 +95,8 @@ jail_setv(int flags, ...)
                        goto error;
                if (jailparam_import(jp + njp, value) < 0)
                        goto error;
-               if (!strcmp(name, "desc")
-                   && (flags & (JAIL_GET_DESC | JAIL_OWN_DESC))) {
+               if (!strcmp(name, "desc") &&
+                   (flags & (JAIL_GET_DESC | JAIL_OWN_DESC))) {
                        jp_desc = jp + njp;
                        desc_value = value;
                }
@@ -145,8 +145,8 @@ jail_getv(int flags, ...)
                        va_end(tap);
                        goto error;
                }
-               if (!strcmp(jp[njp].jp_name, "desc")
-                   && (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) {
+               if (!strcmp(jp[njp].jp_name, "desc") &&
+                   (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) {
                        jp_desc = jp + njp;
                        desc_value = value;
                } else if (!strcmp(jp[njp].jp_name, "lastjid")) {
@@ -181,8 +181,8 @@ jail_getv(int flags, ...)
        }
        if (jailparam_import(jp_key, key_value) < 0)
                goto error;
-       if (jp_desc != NULL && jp_desc != jp_key
-           && jailparam_import(jp_desc, desc_value) < 0)
+       if (jp_desc != NULL && jp_desc != jp_key &&
+           jailparam_import(jp_desc, desc_value) < 0)
                goto error;
        /* Get the jail and export the parameters. */
        jid = jailparam_get(jp, njp, flags);
@@ -604,8 +604,8 @@ jailparam_get(struct jailparam *jp, unsigned njp, int flags)
        jp_desc = jp_lastjid = jp_jid = jp_name = NULL;
        arrays = 0;
        for (ai = j = 0; j < njp; j++) {
-               if (!strcmp(jp[j].jp_name, "desc")
-                   && (flags & (JAIL_USE_DESC | JAIL_AT_DESC)))
+               if (!strcmp(jp[j].jp_name, "desc") &&
+                   (flags & (JAIL_USE_DESC | JAIL_AT_DESC)))
                        jp_desc = jp + j;
                else if (!strcmp(jp[j].jp_name, "lastjid"))
                        jp_lastjid = jp + j;
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 5a1fbe23ddeb..51a8b5cc0465 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -1033,13 +1033,13 @@ kern_jail_set(struct thread *td, struct uio *optuio, 
int flags)
        char numbuf[12];
 
        mypr = td->td_ucred->cr_prison;
-       if (((flags & (JAIL_CREATE | JAIL_AT_DESC)) == JAIL_CREATE)
-           && mypr->pr_childmax == 0)
+       if (((flags & (JAIL_CREATE | JAIL_AT_DESC)) == JAIL_CREATE) &&
+           mypr->pr_childmax == 0)
                return (EPERM);
        if (flags & ~JAIL_SET_MASK)
                return (EINVAL);
-       if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC))
-           == (JAIL_USE_DESC | JAIL_AT_DESC))
+       if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) ==
+           (JAIL_USE_DESC | JAIL_AT_DESC))
                return (EINVAL);
        prison_hold(mypr);
 
@@ -1098,9 +1098,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
                        error = jaildesc_find(td, jfd_in, &desc_in, &mypr,
                            NULL);
                        if (error != 0) {
-                               vfs_opterror(opts, error == ENOENT
-                                   ? "descriptor to dead jail"
-                                   : "not a jail descriptor");
+                               vfs_opterror(opts, error == ENOENT ?
+                                   "descriptor to dead jail" :
+                                   "not a jail descriptor");
                                goto done_errmsg;
                        }
                        /*
@@ -1518,9 +1518,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int 
flags)
                /* Get the jail from its descriptor. */
                error = jaildesc_find(td, jfd_in, &desc_in, &pr, &jdcred);
                if (error) {
-                       vfs_opterror(opts, error == ENOENT
-                           ? "descriptor to dead jail"
-                           : "not a jail descriptor");
+                       vfs_opterror(opts, error == ENOENT ?
+                           "descriptor to dead jail" :
+                           "not a jail descriptor");
                        goto done_deref;
                }
                drflags |= PD_DEREF;
@@ -2512,8 +2512,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int 
flags)
 
        if (flags & ~JAIL_GET_MASK)
                return (EINVAL);
-       if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC))
-           == (JAIL_USE_DESC | JAIL_AT_DESC))
+       if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) ==
+           (JAIL_USE_DESC | JAIL_AT_DESC))
                return (EINVAL);
 
        /* Get the parameter list. */
@@ -2549,9 +2549,9 @@ kern_jail_get(struct thread *td, struct uio *optuio, int 
flags)
                        /* Get the jail from its descriptor. */
                        error = jaildesc_find(td, jfd_in, &desc_in, &pr, NULL);
                        if (error) {
-                               vfs_opterror(opts, error == ENOENT
-                                   ? "descriptor to dead jail"
-                                   : "not a jail descriptor");
+                               vfs_opterror(opts, error == ENOENT ?
+                                   "descriptor to dead jail" :
+                                   "not a jail descriptor");
                                goto done;
                        }
                        drflags |= PD_DEREF;
@@ -2576,9 +2576,9 @@ kern_jail_get(struct thread *td, struct uio *optuio, int 
flags)
                        error = jaildesc_find(td, jfd_in, &desc_in, &mypr,
                            NULL);
                        if (error != 0) {
-                               vfs_opterror(opts, error == ENOENT
-                                   ? "descriptor to dead jail"
-                                   : "not a jail descriptor");
+                               vfs_opterror(opts, error == ENOENT ?
+                                   "descriptor to dead jail" :
+                                   "not a jail descriptor");
                                goto done;
                        }
                        error = vaccess(VREG, desc_in->jd_mode, desc_in->jd_uid,
diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c
index b4ffad4c88e8..72e2845aaf42 100644
--- a/sys/kern/kern_jaildesc.c
+++ b/sys/kern/kern_jaildesc.c
@@ -137,14 +137,14 @@ jaildesc_alloc(struct thread *td, struct file **fpp, int 
*fdp, int owning)
                free(jd, M_JAILDESC);
                return (error);
        }
-       finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0
-           ? FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops);
+       finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 ?
+           FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops);
        JAILDESC_LOCK_INIT(jd);
        jd->jd_uid = fp->f_cred->cr_uid;
        jd->jd_gid = fp->f_cred->cr_gid;
-       jd->jd_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | mode
-           | (priv_check(td, PRIV_JAIL_SET) == 0 ? S_IWUSR | S_IXUSR : 0)
-           | (priv_check(td, PRIV_JAIL_ATTACH) == 0 ? S_IXUSR : 0);
+       jd->jd_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | mode |
+           (priv_check(td, PRIV_JAIL_SET) == 0 ? S_IWUSR | S_IXUSR : 0) |
+           (priv_check(td, PRIV_JAIL_ATTACH) == 0 ? S_IXUSR : 0);
        *fpp = fp;
        return (0);
 }
@@ -167,7 +167,7 @@ jaildesc_set_prison(struct file *fp, struct prison *pr)
 }
 
 /*
- * Detach the all jail descriptors from a prison.
+ * Detach all the jail descriptors from a prison.
  */
 void
 jaildesc_prison_cleanup(struct prison *pr)
@@ -264,13 +264,13 @@ jaildesc_chmod(struct file *fp, mode_t mode, struct ucred 
*active_cred,
        int error;
 
        /* Reject permissions that the creator doesn't have. */
-       if (((mode & (S_IWUSR | S_IWGRP | S_IWOTH))
-           && priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0)
-           || ((mode & (S_IXUSR | S_IXGRP | S_IXOTH))
-           && priv_check_cred(fp->f_cred, PRIV_JAIL_ATTACH) != 0
-           && priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0)
-           || ((mode & S_ISTXT)
-           && priv_check_cred(fp->f_cred, PRIV_JAIL_REMOVE) != 0))
+       if (((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) &&
+           priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) ||
+           ((mode & (S_IXUSR | S_IXGRP | S_IXOTH)) &&
+           priv_check_cred(fp->f_cred, PRIV_JAIL_ATTACH) != 0 &&
+           priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) ||
+           ((mode & S_ISTXT) &&
+           priv_check_cred(fp->f_cred, PRIV_JAIL_REMOVE) != 0))
                return (EPERM);
        if (mode & (S_ISUID | S_ISGID))
                return (EINVAL);

Reply via email to