* [PATCH] KEYS: trusted: dcp: Use kfree_sensitive() to fix Coccinelle warnings
@ 2025-03-20 10:35 Bo Liu
2025-03-20 15:16 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Bo Liu @ 2025-03-20 10:35 UTC (permalink / raw)
To: dhowells, James.Bottomley, jarkko, zohar, paul, jmorris, serge
Cc: linux-integrity, keyrings, linux-security-module, linux-kernel, Bo Liu
Replace memzero_explicit() and kfree() with kfree_sensitive() to fix
warnings reported by Coccinelle:
WARNING opportunity for kfree_sensitive/kvfree_sensitive
WARNING opportunity for kfree_sensitive/kvfree_sensitive
Signed-off-by: Bo Liu <liubo03@inspur.com>
---
security/keys/trusted-keys/trusted_dcp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/security/keys/trusted-keys/trusted_dcp.c b/security/keys/trusted-keys/trusted_dcp.c
index 7b6eb655df0c..c967837e72ee 100644
--- a/security/keys/trusted-keys/trusted_dcp.c
+++ b/security/keys/trusted-keys/trusted_dcp.c
@@ -233,8 +233,7 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
ret = 0;
out:
- memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
- kfree(plain_blob_key);
+ kfree_sensitive(plain_blob_key);
return ret;
}
@@ -283,8 +282,7 @@ static int trusted_dcp_unseal(struct trusted_key_payload *p, char *datablob)
ret = 0;
out:
if (plain_blob_key) {
- memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
- kfree(plain_blob_key);
+ kfree_sensitive(plain_blob_key);
}
return ret;
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] KEYS: trusted: dcp: Use kfree_sensitive() to fix Coccinelle warnings
2025-03-20 10:35 [PATCH] KEYS: trusted: dcp: Use kfree_sensitive() to fix Coccinelle warnings Bo Liu
@ 2025-03-20 15:16 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2025-03-20 15:16 UTC (permalink / raw)
To: Bo Liu
Cc: dhowells, James.Bottomley, zohar, paul, jmorris, serge,
linux-integrity, keyrings, linux-security-module, linux-kernel
On Thu, Mar 20, 2025 at 06:35:57AM -0400, Bo Liu wrote:
> Replace memzero_explicit() and kfree() with kfree_sensitive() to fix
> warnings reported by Coccinelle:
>
> WARNING opportunity for kfree_sensitive/kvfree_sensitive
> WARNING opportunity for kfree_sensitive/kvfree_sensitive
Even if you get the error from Coccinelle, you should still go trouble
why this warning happens. Otherwise, you are contributing a change that
you don't understand yourself.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
> security/keys/trusted-keys/trusted_dcp.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/security/keys/trusted-keys/trusted_dcp.c b/security/keys/trusted-keys/trusted_dcp.c
> index 7b6eb655df0c..c967837e72ee 100644
> --- a/security/keys/trusted-keys/trusted_dcp.c
> +++ b/security/keys/trusted-keys/trusted_dcp.c
> @@ -233,8 +233,7 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
> ret = 0;
>
> out:
> - memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
> - kfree(plain_blob_key);
> + kfree_sensitive(plain_blob_key);
>
> return ret;
> }
> @@ -283,8 +282,7 @@ static int trusted_dcp_unseal(struct trusted_key_payload *p, char *datablob)
> ret = 0;
> out:
> if (plain_blob_key) {
> - memzero_explicit(plain_blob_key, AES_KEYSIZE_128);
> - kfree(plain_blob_key);
> + kfree_sensitive(plain_blob_key);
> }
>
> return ret;
> --
> 2.31.1
>
Not gonna fly because you did not include KEYS-TRUSTED-DCP maintainer to
the CC list.
BR, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-20 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-20 10:35 [PATCH] KEYS: trusted: dcp: Use kfree_sensitive() to fix Coccinelle warnings Bo Liu
2025-03-20 15:16 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®