aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-12-06 23:33:47 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:25 -0500
commit48ad504ee7d598431cb2d0b2f01c6d1aff1d2a07 (patch)
tree52862e12cdca605b04959fc0fa28164dc015013b
parent7cf9c2c76c1a17b32f2da85b50cd4fe468ed44b5 (diff)
[PATCH] security/keys/*: user kmemdup()
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-By: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--security/keys/key.c4
-rw-r--r--security/keys/keyring.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 0db816f10f85..ac9326c5f1da 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -290,11 +290,9 @@ struct key *key_alloc(struct key_type *type, const char *desc,
290 goto no_memory_2; 290 goto no_memory_2;
291 291
292 if (desc) { 292 if (desc) {
293 key->description = kmalloc(desclen, GFP_KERNEL); 293 key->description = kmemdup(desc, desclen, GFP_KERNEL);
294 if (!key->description) 294 if (!key->description)
295 goto no_memory_3; 295 goto no_memory_3;
296
297 memcpy(key->description, desc, desclen);
298 } 296 }
299 297
300 atomic_set(&key->usage, 1); 298 atomic_set(&key->usage, 1);
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index e8d02acc51e7..ad45ce73964b 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -706,12 +706,10 @@ int __key_link(struct key *keyring, struct key *key)
706 BUG_ON(size > PAGE_SIZE); 706 BUG_ON(size > PAGE_SIZE);
707 707
708 ret = -ENOMEM; 708 ret = -ENOMEM;
709 nklist = kmalloc(size, GFP_KERNEL); 709 nklist = kmemdup(klist, size, GFP_KERNEL);
710 if (!nklist) 710 if (!nklist)
711 goto error2; 711 goto error2;
712 712
713 memcpy(nklist, klist, size);
714
715 /* replace matched key */ 713 /* replace matched key */
716 atomic_inc(&key->usage); 714 atomic_inc(&key->usage);
717 nklist->keys[loop] = key; 715 nklist->keys[loop] = key;