Skip to content

Commit 1864825

Browse files
thomasmeyliewegas
authored andcommitted
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>
1 parent 805a6af commit 1864825

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎net/ceph/crypto.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
1515
const struct ceph_crypto_key *src)
1616
{
1717
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);
1919
if (!dst->key)
2020
return -ENOMEM;
21-
memcpy(dst->key, src->key, src->len);
2221
return 0;
2322
}
2423

0 commit comments

Comments
 (0)