Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't leak an unused sysctl log. Found by kLSan.



details:   https://anonhg.NetBSD.org/src/rev/72825b4b8fb4
branches:  trunk
changeset: 935033:72825b4b8fb4
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jun 22 16:29:24 2020 +0000

description:
Don't leak an unused sysctl log. Found by kLSan.

diffstat:

 sys/kern/tty.c |  21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diffs (75 lines):

diff -r 284829831c17 -r 72825b4b8fb4 sys/kern/tty.c
--- a/sys/kern/tty.c    Mon Jun 22 16:26:52 2020 +0000
+++ b/sys/kern/tty.c    Mon Jun 22 16:29:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.287 2020/05/23 23:42:43 ad Exp $     */
+/*     $NetBSD: tty.c,v 1.288 2020/06/22 16:29:24 maxv Exp $   */
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.287 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.288 2020/06/22 16:29:24 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -297,10 +297,8 @@
 sysctl_kern_tty_setup(void)
 {
        const struct sysctlnode *rnode, *cnode;
-       struct sysctllog *kern_tkstat_sysctllog, *kern_tty_sysctllog;
 
-       kern_tkstat_sysctllog = NULL;
-       sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
+       sysctl_createv(NULL, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_NODE, "tkstat",
                       SYSCTL_DESCR("Number of characters sent and received "
@@ -308,38 +306,37 @@
                       NULL, 0, NULL, 0,
                       CTL_KERN, KERN_TKSTAT, CTL_EOL);
 
-       sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
+       sysctl_createv(NULL, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_QUAD, "nin",
                       SYSCTL_DESCR("Total number of tty input characters"),
                       NULL, 0, &tk_nin, 0,
                       CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_NIN, CTL_EOL);
-       sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
+       sysctl_createv(NULL, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_QUAD, "nout",
                       SYSCTL_DESCR("Total number of tty output characters"),
                       NULL, 0, &tk_nout, 0,
                       CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_NOUT, CTL_EOL);
-       sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
+       sysctl_createv(NULL, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_QUAD, "cancc",
                       SYSCTL_DESCR("Number of canonical tty input characters"),
                       NULL, 0, &tk_cancc, 0,
                       CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_CANCC, CTL_EOL);
-       sysctl_createv(&kern_tkstat_sysctllog, 0, NULL, NULL,
+       sysctl_createv(NULL, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_QUAD, "rawcc",
                       SYSCTL_DESCR("Number of raw tty input characters"),
                       NULL, 0, &tk_rawcc, 0,
                       CTL_KERN, KERN_TKSTAT, KERN_TKSTAT_RAWCC, CTL_EOL);
 
-       kern_tty_sysctllog = NULL;
-       sysctl_createv(&kern_tty_sysctllog, 0, NULL, &rnode,
+       sysctl_createv(NULL, 0, NULL, &rnode,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_NODE, "tty", NULL,
                       NULL, 0, NULL, 0,
                       CTL_KERN, CTL_CREATE, CTL_EOL);
-       sysctl_createv(&kern_tty_sysctllog, 0, &rnode, &cnode,
+       sysctl_createv(NULL, 0, &rnode, &cnode,
                       CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
                       CTLTYPE_INT, "qsize",
                       SYSCTL_DESCR("TTY input and output queue size"),



Home | Main Index | Thread Index | Old Index