Commit a618bb0f authored by Kristof Provost's avatar Kristof Provost
Browse files

pf: counter argument to pfr_pool_get() may never be NULL

Coverity points out that if counter was NULL when passed to
pfr_pool_get() we could potentially end up dereferencing it.
Happily all users of the function pass a non-NULL pointer. Enforce this
by assertion and remove the pointless NULL check.

Reported by:	Coverity (CID 273309)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit efc64d02)
parent f3b722fe
......@@ -2211,6 +2211,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
int idx = -1, use_counter = 0;
MPASS(pidx != NULL);
MPASS(counter != NULL);
switch (af) {
case AF_INET:
......@@ -2230,7 +2231,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
return (-1);
idx = *pidx;
if (counter != NULL && idx >= 0)
if (idx >= 0)
use_counter = 1;
if (idx < 0)
idx = 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment