Commit 18648256 authored by Thomas Meyer's avatar Thomas Meyer Committed by Sage Weil

ceph: Use kmemdup rather than duplicating its implementation

Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.
Signed-off-by: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 805a6af8
...@@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst, ...@@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
const struct ceph_crypto_key *src) const struct ceph_crypto_key *src)
{ {
memcpy(dst, src, sizeof(struct ceph_crypto_key)); memcpy(dst, src, sizeof(struct ceph_crypto_key));
dst->key = kmalloc(src->len, GFP_NOFS); dst->key = kmemdup(src->key, src->len, GFP_NOFS);
if (!dst->key) if (!dst->key)
return -ENOMEM; return -ENOMEM;
memcpy(dst->key, src->key, src->len);
return 0; return 0;
} }
......
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