diff options
author | Eric Biggers <ebiggers@google.com> | 2017-09-21 13:57:42 -0700 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2017-09-25 15:19:57 +0100 |
commit | e007ce9c59bddd1e67b94bc29036d920f5c5428a (patch) | |
tree | 19bbe9dc2f0df9bc1c423a9e01c9383627aeb18e /security/keys/request_key_auth.c | |
parent | 4aa68e07d845562561f5e73c04aa521376e95252 (diff) | |
download | linux-stable-e007ce9c59bddd1e67b94bc29036d920f5c5428a.tar.gz linux-stable-e007ce9c59bddd1e67b94bc29036d920f5c5428a.tar.bz2 linux-stable-e007ce9c59bddd1e67b94bc29036d920f5c5428a.zip |
KEYS: use kmemdup() in request_key_auth_new()
kmemdup() is preferred to kmalloc() followed by memcpy().
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/request_key_auth.c')
-rw-r--r-- | security/keys/request_key_auth.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c index e356075ed2f8..6ebf1af8fce9 100644 --- a/security/keys/request_key_auth.c +++ b/security/keys/request_key_auth.c @@ -163,9 +163,10 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info, rka = kzalloc(sizeof(*rka), GFP_KERNEL); if (!rka) goto error; - rka->callout_info = kmalloc(callout_len, GFP_KERNEL); + rka->callout_info = kmemdup(callout_info, callout_len, GFP_KERNEL); if (!rka->callout_info) goto error_free_rka; + rka->callout_len = callout_len; /* see if the calling process is already servicing the key request of * another process */ @@ -196,8 +197,6 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info, rka->target_key = key_get(target); rka->dest_keyring = key_get(dest_keyring); - memcpy(rka->callout_info, callout_info, callout_len); - rka->callout_len = callout_len; /* allocate the auth key */ sprintf(desc, "%x", target->serial); |