Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs/procfs Use a single "p" variable.



details:   https://anonhg.NetBSD.org/src/rev/ca17f36a56a3
branches:  trunk
changeset: 359586:ca17f36a56a3
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jan 11 11:10:46 2022 +0000

description:
Use a single "p" variable.

Should fix PR kern/56614: kernel panic on tmux

diffstat:

 sys/miscfs/procfs/procfs_vnops.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (66 lines):

diff -r ae04bdef32aa -r ca17f36a56a3 sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Tue Jan 11 10:53:08 2022 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Tue Jan 11 11:10:46 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.222 2022/01/10 23:16:05 christos Exp $      */
+/*     $NetBSD: procfs_vnops.c,v 1.223 2022/01/11 11:10:46 hannken Exp $       */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.222 2022/01/10 23:16:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.223 2022/01/11 11:10:46 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -1287,6 +1287,7 @@
        struct vnode *vp;
        const struct proc_target *pt;
        struct procfs_root_readdir_ctx ctx;
+       struct proc *p = NULL;
        struct lwp *l;
        int nfd;
        int nc = 0;
@@ -1312,7 +1313,6 @@
         * from the procent[] table (top of this file).
         */
        case PFSproc: {
-               struct proc *p;
 
                if (i >= nproc_targets)
                        return 0;
@@ -1355,7 +1355,6 @@
                break;
        }
        case PFSfd: {
-               struct proc *p;
                file_t *fp;
                int lim;
 
@@ -1421,7 +1420,6 @@
                goto out;
        }
        case PFStask: {
-               struct proc *p;
 
                if ((error = procfs_proc_lock(vp->v_mount, pfs->pfs_pid, &p,
                                              ESRCH)) != 0)
@@ -1475,7 +1473,6 @@
         */
 
        case PFSroot: {
-               struct proc *p;
 
                if (ap->a_ncookies) {
                        /*
@@ -1567,6 +1564,7 @@
                                *cookies++ = i + 1;
                }
 out:
+               KASSERT(p != NULL);
                ncookies = nc;
                procfs_proc_unlock(p);
                break;



Home | Main Index | Thread Index | Old Index