Skip to content

Commit

Permalink
ceph: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Meyer authored and Sage Weil committed Jan 10, 2012
1 parent 805a6af commit 1864825
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ceph/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
const struct ceph_crypto_key *src)
{
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)
return -ENOMEM;
memcpy(dst->key, src->key, src->len);
return 0;
}

Expand Down

0 comments on commit 1864825

Please sign in to comment.