Linux cryptographic layer development
 help / color / mirror / Atom feed
From: kbuild test robot <fengguang.wu@intel.com>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: kbuild-all@01.org, linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH] crypto: fix memdup.cocci warnings
Date: Fri, 16 Feb 2018 00:40:13 +0800	[thread overview]
Message-ID: <20180215164013.GA107126@lkp-hsx02> (raw)
In-Reply-To: <201802160011.TvUkTLwK%fengguang.wu@intel.com>

From: Fengguang Wu <fengguang.wu@intel.com>

drivers/crypto/ccree/cc_cipher.c:629:15-22: WARNING opportunity for kmemdep

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: 63ee04c8b491 ("crypto: ccree - add skcipher support")
CC: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 cc_cipher.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -626,12 +626,11 @@ static int cc_cipher_process(struct skci
 	/* The IV we are handed may be allocted from the stack so
 	 * we must copy it to a DMAable buffer before use.
 	 */
-	req_ctx->iv = kmalloc(ivsize, flags);
+	req_ctx->iv = kmemdup(iv, ivsize, flags);
 	if (!req_ctx->iv) {
 		rc = -ENOMEM;
 		goto exit_process;
 	}
-	memcpy(req_ctx->iv, iv, ivsize);
 
 	/*For CTS in case of data size aligned to 16 use CBC mode*/
 	if (((nbytes % AES_BLOCK_SIZE) == 0) &&

  reply	other threads:[~2018-02-15 16:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 16:40 [cryptodev:master 9/38] drivers/crypto/ccree/cc_cipher.c:629:15-22: WARNING opportunity for kmemdep kbuild test robot
2018-02-15 16:40 ` kbuild test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-11-01  8:55 [PATCH] crypto: fix memdup.cocci warnings Julia Lawall
2019-11-01 12:52 ` Corentin Labbe
2019-11-08 15:20 ` Herbert Xu

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=20180215164013.GA107126@lkp-hsx02 \
    --to=fengguang.wu@intel.com \
    --cc=gilad@benyossef.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kbuild-all@01.org \
    --cc=linux-crypto@vger.kernel.org \
    /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