KEYS: remove a bogus NULL check
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 11 Dec 2014 19:59:38 +0000 (19:59 +0000)
committerJames Morris <james.l.morris@oracle.com>
Tue, 16 Dec 2014 07:05:20 +0000 (18:05 +1100)
We already checked if "desc" was NULL at the beginning of the function
and we've dereferenced it so this causes a static checker warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
security/keys/key.c

index e17ba6aefdc0820b6c5c3af7cfc90d4e20094915..aee2ec5a18fcafc02e5e9088b9b55b9276bbcdd9 100644 (file)
@@ -276,12 +276,10 @@ struct key *key_alloc(struct key_type *type, const char *desc,
        if (!key)
                goto no_memory_2;
 
-       if (desc) {
-               key->index_key.desc_len = desclen;
-               key->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);
-               if (!key->description)
-                       goto no_memory_3;
-       }
+       key->index_key.desc_len = desclen;
+       key->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);
+       if (!key->description)
+               goto no_memory_3;
 
        atomic_set(&key->usage, 1);
        init_rwsem(&key->sem);