[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:
parent
7cf9c2c76c
commit
48ad504ee7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user