Use zfree() instead of bzero() and free().

These bzero's should have been explicit_bzero's.

Reviewed by:	cem, delphij
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D25437
This commit is contained in:
John Baldwin 2020-06-25 20:20:22 +00:00
parent 17a831ea25
commit b172f23dd7
4 changed files with 9 additions and 18 deletions

View File

@ -357,10 +357,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses,
fpu_kern_leave(curthread, ctx);
RELEASE_CTX(i, ctx);
}
if (allocated) {
bzero(buf, crp->crp_payload_length);
free(buf, M_ARMV8_CRYPTO);
}
if (allocated)
zfree(buf, M_ARMV8_CRYPTO);
return (0);
}

View File

@ -199,8 +199,7 @@ padlock_sha_free(void *vctx)
ctx = vctx;
if (ctx->psc_buf != NULL) {
//bzero(ctx->psc_buf, ctx->psc_size);
free(ctx->psc_buf, M_PADLOCK);
zfree(ctx->psc_buf, M_PADLOCK);
ctx->psc_buf = NULL;
ctx->psc_offset = 0;
ctx->psc_size = 0;
@ -415,14 +414,12 @@ padlock_hash_free(struct padlock_session *ses)
if (ses->ses_ictx != NULL) {
padlock_free_ctx(ses->ses_axf, ses->ses_ictx);
bzero(ses->ses_ictx, ses->ses_axf->ctxsize);
free(ses->ses_ictx, M_PADLOCK);
zfree(ses->ses_ictx, M_PADLOCK);
ses->ses_ictx = NULL;
}
if (ses->ses_octx != NULL) {
padlock_free_ctx(ses->ses_axf, ses->ses_octx);
bzero(ses->ses_octx, ses->ses_axf->ctxsize);
free(ses->ses_octx, M_PADLOCK);
zfree(ses->ses_octx, M_PADLOCK);
ses->ses_octx = NULL;
}
}

View File

@ -145,13 +145,11 @@ glxsb_hash_free(struct glxsb_session *ses)
{
if (ses->ses_ictx != NULL) {
bzero(ses->ses_ictx, ses->ses_axf->ctxsize);
free(ses->ses_ictx, M_GLXSB);
zfree(ses->ses_ictx, M_GLXSB);
ses->ses_ictx = NULL;
}
if (ses->ses_octx != NULL) {
bzero(ses->ses_octx, ses->ses_axf->ctxsize);
free(ses->ses_octx, M_GLXSB);
zfree(ses->ses_octx, M_GLXSB);
ses->ses_octx = NULL;
}
}

View File

@ -1005,8 +1005,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
g_destroy_consumer(cp);
g_destroy_geom(gp);
g_eli_key_destroy(sc);
bzero(sc, sizeof(*sc));
free(sc, M_ELI);
zfree(sc, M_ELI);
return (NULL);
}
@ -1049,8 +1048,7 @@ g_eli_destroy(struct g_eli_softc *sc, boolean_t force)
mtx_destroy(&sc->sc_queue_mtx);
gp->softc = NULL;
g_eli_key_destroy(sc);
bzero(sc, sizeof(*sc));
free(sc, M_ELI);
zfree(sc, M_ELI);
G_ELI_DEBUG(0, "Device %s destroyed.", gp->name);
g_wither_geom_close(gp, ENXIO);