From owner-svn-src-head@freebsd.org Thu Jan 25 00:16:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80935ECEBC5; Thu, 25 Jan 2018 00:16:32 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F52D7F269; Thu, 25 Jan 2018 00:16:31 +0000 (UTC) (envelope-from srs0=ghjn=eu=freebsd.org=kp@codepro.be) Received: from [192.168.228.1] (unknown [138.44.250.147]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 24399BC69; Thu, 25 Jan 2018 01:16:27 +0100 (CET) From: "Kristof Provost" To: "Gleb Smirnoff" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328313 - head/sys/netpfil/pf Date: Thu, 25 Jan 2018 11:16:23 +1100 X-Mailer: MailMate (2.0BETAr6103) Message-ID: In-Reply-To: <20180125001310.GJ8113@FreeBSD.org> References: <201801240429.w0O4THIl059440@repo.freebsd.org> <20180125001310.GJ8113@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; markup=markdown X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jan 2018 00:16:32 -0000 On 25 Jan 2018, at 11:13, Gleb Smirnoff wrote: > On Wed, Jan 24, 2018 at 04:29:17AM +0000, Kristof Provost wrote: > K> Author: kp > K> Date: Wed Jan 24 04:29:16 2018 > K> New Revision: 328313 > K> URL: https://svnweb.freebsd.org/changeset/base/328313 > K> > K> Log: > K> pf: States have at least two references > K> > K> pf_unlink_state() releases a reference to the state without > checking if > K> this is the last reference. It can't be, because > pf_state_insert() > K> initialises it to two. KASSERT() that this is always the case. > K> > K> CID: 1347140 > K> > K> + last = refcount_release(&s->refs); > K> + KASSERT(last == 0, ("Incorrect state reference count")); > K> > K> return (pf_release_state(s)); > K> } > > IMHO, we shouldn't emit extra code to please Coverity. We can mark it > as a false positive in the interface. It may make sense to add a > comment > for a human to explain why return isn't checked here. > I find the KASSERT() to be a good way of verifying that this assumption is in fact correct. You do have a good point about the comment. Regards, Kristof