Source-Changes-HG archive

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

[src/trunk]: src/sys/net/npf ext_ops does not change during the life cycle an...



details:   https://anonhg.NetBSD.org/src/rev/fd1919c925ed
branches:  trunk
changeset: 781830:fd1919c925ed
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Wed Oct 03 12:24:56 2012 +0000

description:
ext_ops does not change during the life cycle and can be fetched without
the mutex held. This avoids confusion in the compiler about an uninitialized
variable ext_ops.
ok rmind@

diffstat:

 sys/net/npf/npf_rproc.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 31b0dacd222b -r fd1919c925ed sys/net/npf/npf_rproc.c
--- a/sys/net/npf/npf_rproc.c   Wed Oct 03 07:22:59 2012 +0000
+++ b/sys/net/npf/npf_rproc.c   Wed Oct 03 12:24:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_rproc.c,v 1.3 2012/09/16 13:47:41 rmind Exp $      */
+/*     $NetBSD: npf_rproc.c,v 1.4 2012/10/03 12:24:56 mlelstv Exp $    */
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -164,14 +164,16 @@
        ext = npf_ext_lookup(name);
        if (ext) {
                atomic_inc_uint(&ext->ext_refcnt);
-               extops = ext->ext_ops;
-               KASSERT(extops != NULL);
        }
        mutex_exit(&ext_lock);
+
        if (!ext) {
                return ENOENT;
        }
 
+       extops = ext->ext_ops;
+       KASSERT(extops != NULL);
+
        error = extops->ctor(rp, params);
        if (error) {
                atomic_dec_uint(&ext->ext_refcnt);



Home | Main Index | Thread Index | Old Index