2024-05-06 16:53:29

by Jules Irenge

[permalink] [raw]
Subject: [PATCH] s390/pkey: use kvfree_sensitive() to fix Coccinelle warning

Replace memzero_expliocit() and kfree() with kfree_sentive() to fix
warning reported by Coccinelle

WARNING opportunity for kfree_sensitive/kvfree_sensitive

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/s390/crypto/pkey_api.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index dccf664a3d95..76e98275f6ab 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -1503,8 +1503,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
rc = pkey_keyblob2pkey(kkey, ktp.keylen, ktp.protkey.protkey,
&ktp.protkey.len, &ktp.protkey.type);
pr_debug("%s pkey_keyblob2pkey()=%d\n", __func__, rc);
- memzero_explicit(kkey, ktp.keylen);
- kfree(kkey);
+ kvfree_sensitive(kkey, ktp.keylen);
if (rc)
break;
if (copy_to_user(utp, &ktp, sizeof(ktp)))
--
2.43.2