From: Dan Carpenter Date: Thu, 9 Feb 2017 17:18:00 +0000 (+0000) Subject: KEYS: Use memzero_explicit() for secret data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=52176603795c2ab7e9faf6bb94820da1b726aabd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David Howells Acked-by: Mimi Zohar Signed-off-by: James Morris --- 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]); }