mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: Sage Weil <sage@newdream.net>,
	"David S. Miller" <davem@davemloft.net>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ceph: Use kmemdup rather than duplicating its implementation
Date: Thu, 10 Nov 2011 19:45:21 +0100	[thread overview]
Message-ID: <1320950721.20155.111.camel@localhost.localdomain> (raw)

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;
 }
 



             reply	other threads:[~2011-11-10 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 18:45 Thomas Meyer [this message]
2011-11-11  6:19 ` Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320950721.20155.111.camel@localhost.localdomain \
    --to=thomas@m3y3r.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@newdream.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®