kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] KEYS: remove a bogus NULL check
@ 2014-11-22 18:42 Dan Carpenter
  2014-11-24 13:42 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-11-22 18:42 UTC (permalink / raw)
  To: kernel-janitors

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>

diff --git a/security/keys/key.c b/security/keys/key.c
index e17ba6a..aee2ec5 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] KEYS: remove a bogus NULL check
  2014-11-22 18:42 [patch] KEYS: remove a bogus NULL check Dan Carpenter
@ 2014-11-24 13:42 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2014-11-24 13:42 UTC (permalink / raw)
  To: kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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.

Yeah - keys were originally allowed to have no description.

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-24 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-22 18:42 [patch] KEYS: remove a bogus NULL check Dan Carpenter
2014-11-24 13:42 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).