diff options
author | Denis Efremov <efremov@linux.com> | 2020-08-27 10:29:23 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2021-01-21 16:16:09 +0000 |
commit | 272a121940a286d7abaf7ac3ec5a37c5dbfa7b89 (patch) | |
tree | 71810f1062e04b27f7c96124b0e8f8883f2e20a6 /security/keys | |
parent | 8fe62e0c0e2efa5437f3ee81b65d69e70a45ecd2 (diff) |
security/keys: use kvfree_sensitive()
Use kvfree_sensitive() instead of open-coding it.
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Ben Boeckel <mathstuf@gmail.com>
Diffstat (limited to 'security/keys')
-rw-r--r-- | security/keys/big_key.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/security/keys/big_key.c b/security/keys/big_key.c index 691347dea3c1..d17e5f09eeb8 100644 --- a/security/keys/big_key.c +++ b/security/keys/big_key.c @@ -121,8 +121,7 @@ int big_key_preparse(struct key_preparsed_payload *prep) *path = file->f_path; path_get(path); fput(file); - memzero_explicit(buf, enclen); - kvfree(buf); + kvfree_sensitive(buf, enclen); } else { /* Just store the data in a buffer */ void *data = kmalloc(datalen, GFP_KERNEL); @@ -140,8 +139,7 @@ err_fput: err_enckey: kfree_sensitive(enckey); error: - memzero_explicit(buf, enclen); - kvfree(buf); + kvfree_sensitive(buf, enclen); return ret; } @@ -273,8 +271,7 @@ long big_key_read(const struct key *key, char *buffer, size_t buflen) err_fput: fput(file); error: - memzero_explicit(buf, enclen); - kvfree(buf); + kvfree_sensitive(buf, enclen); } else { ret = datalen; memcpy(buffer, key->payload.data[big_key_data], datalen); |