From owner-svn-src-head@freebsd.org Tue Oct 23 23:15:44 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 CE06D1036527; Tue, 23 Oct 2018 23:15:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 855D37609C; Tue, 23 Oct 2018 23:15:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 806FA16A44; Tue, 23 Oct 2018 23:15:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9NNFi7i033385; Tue, 23 Oct 2018 23:15:44 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9NNFiKV033384; Tue, 23 Oct 2018 23:15:44 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201810232315.w9NNFiKV033384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 23 Oct 2018 23:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339674 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 339674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Tue, 23 Oct 2018 23:15:45 -0000 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); }