diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-06-08 14:47:56 +0100 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-06-09 13:29:46 +1000 |
commit | 41f1c53e0d7d6e79087d5f5e18c467747126a3fc (patch) | |
tree | 0a992d5a59483175181e124afce1a2d89de09d84 /security/keys | |
parent | 4e880168e9ffb1cdbdb72b3b48ab0324b30c2d62 (diff) | |
download | linux-stable-41f1c53e0d7d6e79087d5f5e18c467747126a3fc.tar.gz linux-stable-41f1c53e0d7d6e79087d5f5e18c467747126a3fc.tar.bz2 linux-stable-41f1c53e0d7d6e79087d5f5e18c467747126a3fc.zip |
KEYS: Delete an error message for a failed memory allocation in get_derived_key()
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'security/keys')
-rw-r--r-- | security/keys/encrypted-keys/encrypted.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index 0010955d7876..2ab48eab29a1 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c @@ -385,10 +385,9 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, derived_buf_len = HASH_SIZE; derived_buf = kzalloc(derived_buf_len, GFP_KERNEL); - if (!derived_buf) { - pr_err("encrypted_key: out of memory\n"); + if (!derived_buf) return -ENOMEM; - } + if (key_type) strcpy(derived_buf, "AUTH_KEY"); else |