Source-Changes-HG archive

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

[src/trunk]: src/sys/net pfil_psz gets dropped by the compiler because it is ...



details:   https://anonhg.NetBSD.org/src/rev/f7014da3ae63
branches:  trunk
changeset: 935035:f7014da3ae63
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jun 22 16:39:56 2020 +0000

description:
pfil_psz gets dropped by the compiler because it is unused if !NET_MPSAFE,
so add an #ifdef around it, not to leak memory. Found by kLSan.

diffstat:

 sys/net/pfil.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 2f6b72b13e16 -r f7014da3ae63 sys/net/pfil.c
--- a/sys/net/pfil.c    Mon Jun 22 16:34:57 2020 +0000
+++ b/sys/net/pfil.c    Mon Jun 22 16:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.38 2020/04/27 23:35:40 nat Exp $    */
+/*     $NetBSD: pfil.c,v 1.39 2020/06/22 16:39:56 maxv Exp $   */
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.38 2020/04/27 23:35:40 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.39 2020/06/22 16:39:56 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -86,13 +86,17 @@
 
 static kmutex_t pfil_mtx __cacheline_aligned;
 static struct psref_class *pfil_psref_class __read_mostly;
+#ifdef NET_MPSAFE
 static pserialize_t pfil_psz;
+#endif
 
 void
 pfil_init(void)
 {
        mutex_init(&pfil_mtx, MUTEX_DEFAULT, IPL_NONE);
+#ifdef NET_MPSAFE
        pfil_psz = pserialize_create();
+#endif
        pfil_psref_class = psref_class_create("pfil", IPL_SOFTNET);
 }
 



Home | Main Index | Thread Index | Old Index