diff options
author | Thomas Meyer <thomas@m3y3r.de> | 2011-11-10 13:45:21 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2012-01-10 11:56:54 -0500 |
commit | 186482560f660b8dbf77ee43aa6489cb45d342cd (patch) | |
tree | 313156ea6ce1311fba0c569ac0fc51cafaca9d4b | |
parent | 805a6af8dba5dfdd35ec35dc52ec0122400b2610 (diff) |
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: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | net/ceph/crypto.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 85f3bc0a7062..b780cb7947dd 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
@@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst, | |||
15 | const struct ceph_crypto_key *src) | 15 | const struct ceph_crypto_key *src) |
16 | { | 16 | { |
17 | memcpy(dst, src, sizeof(struct ceph_crypto_key)); | 17 | memcpy(dst, src, sizeof(struct ceph_crypto_key)); |
18 | dst->key = kmalloc(src->len, GFP_NOFS); | 18 | dst->key = kmemdup(src->key, src->len, GFP_NOFS); |
19 | if (!dst->key) | 19 | if (!dst->key) |
20 | return -ENOMEM; | 20 | return -ENOMEM; |
21 | memcpy(dst->key, src->key, src->len); | ||
22 | return 0; | 21 | return 0; |
23 | } | 22 | } |
24 | 23 | ||