summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-02-09 17:18:00 +0000
committerJames Morris <james.l.morris@oracle.com>2017-02-10 12:43:51 +1100
commit52176603795c2ab7e9faf6bb94820da1b726aabd (patch)
treeb1b7e7c2938d1b9ae0446ed5ce2da554e326d36c /security
parent57cb17e764ba0aaa169d07796acce54ccfbc6cae (diff)
downloadlinux-52176603795c2ab7e9faf6bb94820da1b726aabd.tar.bz2
KEYS: Use memzero_explicit() for secret data
I don't think GCC has figured out how to optimize the memset() away, but they might eventually so let's future proof this code a bit. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'security')
-rw-r--r--security/keys/encrypted-keys/encrypted.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
index d7a4969b2dd3..4fb315cddf5b 100644
--- a/security/keys/encrypted-keys/encrypted.c
+++ b/security/keys/encrypted-keys/encrypted.c
@@ -985,7 +985,7 @@ static void encrypted_destroy(struct key *key)
if (!epayload)
return;
- memset(epayload->decrypted_data, 0, epayload->decrypted_datalen);
+ memzero_explicit(epayload->decrypted_data, epayload->decrypted_datalen);
kfree(key->payload.data[0]);
}