Date: Sat, 20 Mar 2021 09:59:43 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 4ed78443da29 - stable/13 - pf: Simplify cleanup Message-ID: <202103200959.12K9xhip064209@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ed78443da29afe32ef7a395d2aa66b5f257ba5e commit 4ed78443da29afe32ef7a395d2aa66b5f257ba5e Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-03-10 14:15:16 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2021-03-19 22:41:11 +0000 pf: Simplify cleanup We can now counter_u64_free(NULL), so remove the checks. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29190 (cherry picked from commit 28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded) --- sys/netpfil/pf/if_pfsync.c | 6 ++---- sys/netpfil/pf/pf.c | 12 ++++-------- sys/netpfil/pf/pf_if.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 1cdb365c98df..059300f6a6a7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -624,10 +624,8 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { for (int i = 0; i < 2; i++) { - if (st->packets[i] != NULL) - counter_u64_free(st->packets[i]); - if (st->bytes[i] != NULL) - counter_u64_free(st->bytes[i]); + counter_u64_free(st->packets[i]); + counter_u64_free(st->bytes[i]); } if (st->dst.scrub) uma_zfree(V_pf_state_scrub_z, st->dst.scrub); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f71f89187b58..563a81fbd4cb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -707,10 +707,8 @@ pf_free_src_node(struct pf_ksrc_node *sn) { for (int i = 0; i < 2; i++) { - if (sn->bytes[i]) - counter_u64_free(sn->bytes[i]); - if (sn->packets[i]) - counter_u64_free(sn->packets[i]); + counter_u64_free(sn->bytes[i]); + counter_u64_free(sn->packets[i]); } uma_zfree(V_pf_sources_z, sn); } @@ -1739,10 +1737,8 @@ pf_free_state(struct pf_state *cur) cur->timeout)); for (int i = 0; i < 2; i++) { - if (cur->bytes[i] != NULL) - counter_u64_free(cur->bytes[i]); - if (cur->packets[i] != NULL) - counter_u64_free(cur->packets[i]); + counter_u64_free(cur->bytes[i]); + counter_u64_free(cur->packets[i]); } pf_normalize_tcp_cleanup(cur); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index e941e3a79b91..be290a1e1f2e 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -256,10 +256,8 @@ pf_kkif_free(struct pfi_kkif *kif) for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { - if (kif->pfik_packets[i][j][k]) - counter_u64_free(kif->pfik_packets[i][j][k]); - if (kif->pfik_bytes[i][j][k]) - counter_u64_free(kif->pfik_bytes[i][j][k]); + counter_u64_free(kif->pfik_packets[i][j][k]); + counter_u64_free(kif->pfik_bytes[i][j][k]); } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103200959.12K9xhip064209>