From mboxrd@z Thu Jan 1 00:00:00 1970 From: kbuild test robot Subject: [PATCH] crypto: fix memdup.cocci warnings Date: Fri, 16 Feb 2018 00:40:13 +0800 Message-ID: <20180215164013.GA107126@lkp-hsx02> References: <201802160011.TvUkTLwK%fengguang.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kbuild-all@01.org, linux-crypto@vger.kernel.org, Herbert Xu To: Gilad Ben-Yossef Return-path: Received: from mga05.intel.com ([192.55.52.43]:14632 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423484AbeBOQlK (ORCPT ); Thu, 15 Feb 2018 11:41:10 -0500 Content-Disposition: inline In-Reply-To: <201802160011.TvUkTLwK%fengguang.wu@intel.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: From: Fengguang Wu 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 Signed-off-by: Fengguang Wu --- 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) &&