Date: Thu, 1 Feb 2018 07:52:06 +0000 (UTC) From: Kristof Provost <kp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328652 - head/sys/netpfil/pf Message-ID: <201802010752.w117q6Lf056272@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kp Date: Thu Feb 1 07:52:06 2018 New Revision: 328652 URL: https://svnweb.freebsd.org/changeset/base/328652 Log: pf: Avoid warning without INVARIANTS When INVARIANTS is not set the 'last' variable is not used, which can generate compiler warnings. If this invariant is ever violated it'd result in a KASSERT failure in refcount_release(), so this one is not strictly required. Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Thu Feb 1 05:31:24 2018 (r328651) +++ head/sys/netpfil/pf/pf.c Thu Feb 1 07:52:06 2018 (r328652) @@ -1613,7 +1613,6 @@ int pf_unlink_state(struct pf_state *s, u_int flags) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; - int last; if ((flags & PF_ENTER_LOCKED) == 0) PF_HASHROW_LOCK(ih); @@ -1654,8 +1653,9 @@ pf_unlink_state(struct pf_state *s, u_int flags) PF_HASHROW_UNLOCK(ih); pf_detach_state(s); - last = refcount_release(&s->refs); - KASSERT(last == 0, ("Incorrect state reference count")); + /* pf_state_insert() initialises refs to 2, so we can never release the + * last reference here, only in pf_release_state(). */ + (void)refcount_release(&s->refs); return (pf_release_state(s)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802010752.w117q6Lf056272>