svn commit: r328313 - head/sys/netpfil/pf

Kristof Provost kp at FreeBSD.org
Thu Jan 25 00:16:32 UTC 2018


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


More information about the svn-src-head mailing list