[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>
This commit is contained in:
Eric Sesterhenn 2006-12-06 20:33:47 -08:00 committed by Linus Torvalds
parent 7cf9c2c76c
commit 48ad504ee7
2 changed files with 2 additions and 6 deletions

View File

@ -290,11 +290,9 @@ struct key *key_alloc(struct key_type *type, const char *desc,
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);

View File

@ -706,12 +706,10 @@ int __key_link(struct key *keyring, struct key *key)
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;