public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] security/keys/*: user kmemdup()
@ 2006-10-29 20:03 Alexey Dobriyan
  2006-10-30 12:41 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2006-10-29 20:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Howells, linux-kernel, Eric Sesterhenn

From: Eric Sesterhenn <snakebyte@gmx.de>

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 security/keys/key.c     |    4 +---
 security/keys/keyring.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -290,11 +290,9 @@ struct key *key_alloc(struct key_type *t
 		goto no_memory_2;
 
 	if (desc) {
-		key->description = kmalloc(desclen, GFP_KERNEL);
+		key->description = kmemdup(desc, desclen, GFP_KERNEL);
 		if (!key->description)
 			goto no_memory_3;
-
-		memcpy(key->description, desc, desclen);
 	}
 
 	atomic_set(&key->usage, 1);
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -706,12 +706,10 @@ int __key_link(struct key *keyring, stru
 				BUG_ON(size > PAGE_SIZE);
 
 				ret = -ENOMEM;
-				nklist = kmalloc(size, GFP_KERNEL);
+				nklist = kmemdup(klist, size, GFP_KERNEL);
 				if (!nklist)
 					goto error2;
 
-				memcpy(nklist, klist, size);
-
 				/* replace matched key */
 				atomic_inc(&key->usage);
 				nklist->keys[loop] = key;


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

end of thread, other threads:[~2006-10-30 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-29 20:03 [PATCH] security/keys/*: user kmemdup() Alexey Dobriyan
2006-10-30 12:41 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox