Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jun 2020 20:20:23 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362626 - in head/sys: crypto/armv8 crypto/via dev/glxsb geom/eli
Message-ID:  <202006252020.05PKKNcZ002853@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Jun 25 20:20:22 2020
New Revision: 362626
URL: https://svnweb.freebsd.org/changeset/base/362626

Log:
  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

Modified:
  head/sys/crypto/armv8/armv8_crypto.c
  head/sys/crypto/via/padlock_hash.c
  head/sys/dev/glxsb/glxsb_hash.c
  head/sys/geom/eli/g_eli.c

Modified: head/sys/crypto/armv8/armv8_crypto.c
==============================================================================
--- head/sys/crypto/armv8/armv8_crypto.c	Thu Jun 25 20:18:55 2020	(r362625)
+++ head/sys/crypto/armv8/armv8_crypto.c	Thu Jun 25 20:20:22 2020	(r362626)
@@ -357,10 +357,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_sessio
 		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);
 }
 

Modified: head/sys/crypto/via/padlock_hash.c
==============================================================================
--- head/sys/crypto/via/padlock_hash.c	Thu Jun 25 20:18:55 2020	(r362625)
+++ head/sys/crypto/via/padlock_hash.c	Thu Jun 25 20:20:22 2020	(r362626)
@@ -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;
 	}
 }

Modified: head/sys/dev/glxsb/glxsb_hash.c
==============================================================================
--- head/sys/dev/glxsb/glxsb_hash.c	Thu Jun 25 20:18:55 2020	(r362625)
+++ head/sys/dev/glxsb/glxsb_hash.c	Thu Jun 25 20:20:22 2020	(r362626)
@@ -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;
 	}
 }

Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c	Thu Jun 25 20:18:55 2020	(r362625)
+++ head/sys/geom/eli/g_eli.c	Thu Jun 25 20:20:22 2020	(r362626)
@@ -1005,8 +1005,7 @@ failed:
 	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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006252020.05PKKNcZ002853>