* [PATCH] ceph: Use kmemdup rather than duplicating its implementation
@ 2011-11-10 18:45 Thomas Meyer
2011-11-11 6:19 ` Sage Weil
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Meyer @ 2011-11-10 18:45 UTC (permalink / raw)
To: Sage Weil, David S. Miller, ceph-devel, linux-kernel
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>
---
diff -u -p a/net/ceph/crypto.c b/net/ceph/crypto.c
--- a/net/ceph/crypto.c 2011-11-07 19:38:30.130592543 +0100
+++ b/net/ceph/crypto.c 2011-11-08 10:58:06.915274800 +0100
@@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_cr
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ceph: Use kmemdup rather than duplicating its implementation
2011-11-10 18:45 [PATCH] ceph: Use kmemdup rather than duplicating its implementation Thomas Meyer
@ 2011-11-11 6:19 ` Sage Weil
0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2011-11-11 6:19 UTC (permalink / raw)
To: Thomas Meyer; +Cc: David S. Miller, ceph-devel, linux-kernel
Applied, thanks!
On Thu, 10 Nov 2011, Thomas Meyer wrote:
> 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>
> ---
>
> diff -u -p a/net/ceph/crypto.c b/net/ceph/crypto.c
> --- a/net/ceph/crypto.c 2011-11-07 19:38:30.130592543 +0100
> +++ b/net/ceph/crypto.c 2011-11-08 10:58:06.915274800 +0100
> @@ -15,10 +15,9 @@ int ceph_crypto_key_clone(struct ceph_cr
> 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;
> }
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-11 6:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 18:45 [PATCH] ceph: Use kmemdup rather than duplicating its implementation Thomas Meyer
2011-11-11 6:19 ` Sage Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®