mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: herbert@gondor.hengli.com.au, davem@davemloft.net,
	linus.walleij@linaro.org, andreas.westin@stericsson.com,
	arnd@arndb.de, rubini@unipv.it, linux-kernel@vger.kernel.org,
	Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Subject: [PATCH] crypto: replace kmalloc and then memcpy with kmemdup
Date: Mon, 11 Mar 2013 12:48:10 +0200	[thread overview]
Message-ID: <1362998890-7532-1-git-send-email-mihneadb@gmail.com> (raw)

Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
---
 drivers/crypto/ux500/hash/hash_core.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index 632c333..8d16d3a 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -1368,14 +1368,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
 	/**
 	 * Freed in final.
 	 */
-	ctx->key = kmalloc(keylen, GFP_KERNEL);
+	ctx->key = kmemdup(key, keylen, GFP_KERNEL);
 	if (!ctx->key) {
 		pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
 		       "for %d\n", __func__, alg);
 		return -ENOMEM;
 	}
-
-	memcpy(ctx->key, key, keylen);
 	ctx->keylen = keylen;
 
 	return ret;
-- 
1.7.10.4


             reply	other threads:[~2013-03-11 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 10:48 Mihnea Dobrescu-Balaur [this message]
2013-03-21  9:54 ` Herbert Xu
2013-03-21 18:18   ` Linus Walleij

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=1362998890-7532-1-git-send-email-mihneadb@gmail.com \
    --to=mihneadb@gmail.com \
    --cc=andreas.westin@stericsson.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linus.walleij@linaro.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rubini@unipv.it \
    /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®