Commit 48ad504ee7d598431cb2d0b2f01c6d1aff1d2a07
Committed by
Linus Torvalds
1 parent
7cf9c2c76c
Exists in
master
and in
20 other branches
[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>
Showing 2 changed files with 2 additions and 6 deletions Side-by-side Diff
security/keys/key.c
... | ... | @@ -290,11 +290,9 @@ |
290 | 290 | goto no_memory_2; |
291 | 291 | |
292 | 292 | if (desc) { |
293 | - key->description = kmalloc(desclen, GFP_KERNEL); | |
293 | + key->description = kmemdup(desc, desclen, GFP_KERNEL); | |
294 | 294 | if (!key->description) |
295 | 295 | goto no_memory_3; |
296 | - | |
297 | - memcpy(key->description, desc, desclen); | |
298 | 296 | } |
299 | 297 | |
300 | 298 | atomic_set(&key->usage, 1); |
security/keys/keyring.c
... | ... | @@ -706,11 +706,9 @@ |
706 | 706 | BUG_ON(size > PAGE_SIZE); |
707 | 707 | |
708 | 708 | ret = -ENOMEM; |
709 | - nklist = kmalloc(size, GFP_KERNEL); | |
709 | + nklist = kmemdup(klist, size, GFP_KERNEL); | |
710 | 710 | if (!nklist) |
711 | 711 | goto error2; |
712 | - | |
713 | - memcpy(nklist, klist, size); | |
714 | 712 | |
715 | 713 | /* replace matched key */ |
716 | 714 | atomic_inc(&key->usage); |