KEYS: Delete an error message for a failed memory allocation in get_derived_key()
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 8 Jun 2017 13:47:56 +0000 (14:47 +0100)
committerJames Morris <james.l.morris@oracle.com>
Fri, 9 Jun 2017 03:29:46 +0000 (13:29 +1000)
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>
security/keys/encrypted-keys/encrypted.c

index 0010955d7876c2302704020af8b2ffb6010f2c0a..2ab48eab29a1bb8137780e31032801851c658a13 100644 (file)
@@ -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