Author: kp
Date: Tue Oct 23 23:15:44 2018
New Revision: 339674
URL: https://svnweb.freebsd.org/changeset/base/339674

Log:
  pf: ifp can never be NULL in pfi_ifaddr_event()
  
  There's no point in the NULL check for ifp, because we'll already have
  dereferenced it by then. Moreover, the event will always have a valid ifp.
  
  Replace the late check with an early assertion.
  
  CID:          1357338

Modified:
  head/sys/netpfil/pf/pf_if.c

Modified: head/sys/netpfil/pf/pf_if.c
==============================================================================
--- head/sys/netpfil/pf/pf_if.c Tue Oct 23 23:11:38 2018        (r339673)
+++ head/sys/netpfil/pf/pf_if.c Tue Oct 23 23:15:44 2018        (r339674)
@@ -904,6 +904,9 @@ pfi_detach_group_event(void *arg __unused, struct ifg_
 static void
 pfi_ifaddr_event(void *arg __unused, struct ifnet *ifp)
 {
+
+       KASSERT(ifp, ("ifp == NULL"));
+
        if (ifp->if_pf_kif == NULL)
                return;
 
@@ -912,7 +915,7 @@ pfi_ifaddr_event(void *arg __unused, struct ifnet *ifp
                return;
        }
        PF_RULES_WLOCK();
-       if (ifp && ifp->if_pf_kif) {
+       if (ifp->if_pf_kif) {
                V_pfi_update++;
                pfi_kif_update(ifp->if_pf_kif);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to