Skip to content

Commit 22e6824

Browse files
irengeAlexander Gordeev
authored andcommitted
s390/pkey: Use kfree_sensitive() to fix Coccinelle warnings
Replace memzero_explicit() and kfree() with kfree_sensitive() to fix warnings reported by Coccinelle: WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1506) WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1643) WARNING opportunity for kfree_sensitive/kvfree_sensitive (line 1770) Signed-off-by: Jules Irenge <[email protected]> Reviewed-by: Holger Dengler <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 980ffff commit 22e6824

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/s390/crypto/pkey_api.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,8 +1503,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
15031503
rc = pkey_keyblob2pkey(kkey, ktp.keylen, ktp.protkey.protkey,
15041504
&ktp.protkey.len, &ktp.protkey.type);
15051505
pr_debug("%s pkey_keyblob2pkey()=%d\n", __func__, rc);
1506-
memzero_explicit(kkey, ktp.keylen);
1507-
kfree(kkey);
1506+
kfree_sensitive(kkey);
15081507
if (rc)
15091508
break;
15101509
if (copy_to_user(utp, &ktp, sizeof(ktp)))
@@ -1640,8 +1639,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
16401639
&ktp.protkey.type);
16411640
pr_debug("%s pkey_keyblob2pkey2()=%d\n", __func__, rc);
16421641
kfree(apqns);
1643-
memzero_explicit(kkey, ktp.keylen);
1644-
kfree(kkey);
1642+
kfree_sensitive(kkey);
16451643
if (rc)
16461644
break;
16471645
if (copy_to_user(utp, &ktp, sizeof(ktp)))
@@ -1767,8 +1765,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
17671765
protkey, &protkeylen, &ktp.pkeytype);
17681766
pr_debug("%s pkey_keyblob2pkey3()=%d\n", __func__, rc);
17691767
kfree(apqns);
1770-
memzero_explicit(kkey, ktp.keylen);
1771-
kfree(kkey);
1768+
kfree_sensitive(kkey);
17721769
if (rc) {
17731770
kfree(protkey);
17741771
break;

0 commit comments

Comments
 (0)