diff mbox series

crypto: jitter - Use kvfree_sensitive() to fix Coccinelle warning

Message ID 20240327222507.42731-3-thorsten.blum@toblux.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: jitter - Use kvfree_sensitive() to fix Coccinelle warning | expand

Commit Message

Thorsten Blum March 27, 2024, 10:25 p.m. UTC
Replace memzero_explicit() and kvfree() with kvfree_sensitive() to fix
the following Coccinelle/coccicheck warning reported by
kfree_sensitive.cocci:

	WARNING opportunity for kfree_sensitive/kvfree_sensitive

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 crypto/jitterentropy-kcapi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Herbert Xu April 5, 2024, 7:52 a.m. UTC | #1
On Wed, Mar 27, 2024 at 11:25:09PM +0100, Thorsten Blum wrote:
> Replace memzero_explicit() and kvfree() with kvfree_sensitive() to fix
> the following Coccinelle/coccicheck warning reported by
> kfree_sensitive.cocci:
> 
> 	WARNING opportunity for kfree_sensitive/kvfree_sensitive
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>  crypto/jitterentropy-kcapi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index 76edbf8af0ac..c24d4ff2b4a8 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -61,8 +61,7 @@  void *jent_kvzalloc(unsigned int len)
 
 void jent_kvzfree(void *ptr, unsigned int len)
 {
-	memzero_explicit(ptr, len);
-	kvfree(ptr);
+	kvfree_sensitive(ptr, len);
 }
 
 void *jent_zalloc(unsigned int len)