Commit 48ad504e authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Linus Torvalds

[PATCH] security/keys/*: user kmemdup()

Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Acked-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7cf9c2c7
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment