aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c4
1 files changed, 1 insertions, 3 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);