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

pfsync: NULL check before dereference

Move the use of 'sc' to after the NULL check.
It's very unlikely that we'd actually hit this, but Coverity is correct
that it's not a good idea to dereference the pointer and only then NULL
check it.

Reported by:	Coverity (CID 1398362)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
parent ed6287c1
......@@ -1735,7 +1735,7 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
{
struct pfsync_softc *sc = V_pfsyncif;
struct pfsync_deferral *pd;
struct pfsync_bucket *b = pfsync_get_bucket(sc, st);
struct pfsync_bucket *b;
if (m->m_flags & (M_BCAST|M_MCAST))
return (0);
......@@ -1743,6 +1743,8 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
if (sc == NULL)
return (0);
b = pfsync_get_bucket(sc, st);
PFSYNC_LOCK(sc);
if (!(sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) ||
......
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