From dcf581bb49bedcf9c18d6cccc80a9fbd68516d23 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 28 Oct 2022 13:36:13 -0700 Subject: wg: Use zfree. Reviewed by: kevans, markj, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36911 --- sys/dev/wg/if_wg.c | 6 ++---- sys/dev/wg/wg_noise.c | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'sys') diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 59a8d949e8c1..07c33fb98158 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -2452,8 +2452,7 @@ out_locked: sx_xunlock(&sc->sc_lock); nvlist_destroy(nvl); out: - explicit_bzero(nvlpacked, wgd->wgd_size); - free(nvlpacked, M_TEMP); + zfree(nvlpacked, M_TEMP); return (err); } @@ -2577,8 +2576,7 @@ wgc_get(struct wg_softc *sc, struct wg_data_io *wgd) wgd->wgd_size = size; out: - explicit_bzero(packed, size); - free(packed, M_NVLIST); + zfree(packed, M_NVLIST); err: nvlist_destroy(nvl); return (err); diff --git a/sys/dev/wg/wg_noise.c b/sys/dev/wg/wg_noise.c index 095da9dd4a7b..73ee712b11e9 100644 --- a/sys/dev/wg/wg_noise.c +++ b/sys/dev/wg/wg_noise.c @@ -223,8 +223,7 @@ noise_local_put(struct noise_local *l) rw_destroy(&l->l_identity_lock); mtx_destroy(&l->l_remote_mtx); mtx_destroy(&l->l_index_mtx); - explicit_bzero(l, sizeof(*l)); - free(l, M_NOISE); + zfree(l, M_NOISE); } } @@ -472,8 +471,7 @@ noise_remote_smr_free(struct epoch_context *smr) noise_local_put(r->r_local); rw_destroy(&r->r_handshake_lock); mtx_destroy(&r->r_keypair_mtx); - explicit_bzero(r, sizeof(*r)); - free(r, M_NOISE); + zfree(r, M_NOISE); } void @@ -754,8 +752,7 @@ noise_keypair_smr_free(struct epoch_context *smr) kp = __containerof(smr, struct noise_keypair, kp_smr); noise_remote_put(kp->kp_remote); rw_destroy(&kp->kp_nonce_lock); - explicit_bzero(kp, sizeof(*kp)); - free(kp, M_NOISE); + zfree(kp, M_NOISE); } void -- cgit v1.2.3