linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: fix memdup.cocci warnings
@ 2019-11-01  8:55 Julia Lawall
  2019-11-01 12:52 ` Corentin Labbe
  2019-11-08 15:20 ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2019-11-01  8:55 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: kbuild-all, linux-crypto, Herbert Xu, Maxime Ripard,
	Chen-Yu Tsai, linux-crypto, linux-arm-kernel, linux-kernel

From: kbuild test robot <lkp@intel.com>

Use kmemdup rather than duplicating its implementation

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

Fixes: f08fcced6d00 ("crypto: allwinner - Add sun8i-ss cryptographic offloader")
CC: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head:   298b4c604008025b134bc6fccbc4018449945d60
commit: f08fcced6d0017c39cb6eccb571290867119d049 [154/163] crypto: allwinner - Add sun8i-ss cryptographic offloader
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Please take the patch only if it's a positive warning. Thanks!

 sun8i-ss-cipher.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
@@ -398,10 +398,9 @@ int sun8i_ss_aes_setkey(struct crypto_sk
 		kfree(op->key);
 	}
 	op->keylen = keylen;
-	op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA);
+	op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
 	if (!op->key)
 		return -ENOMEM;
-	memcpy(op->key, key, keylen);

 	crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
 	crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
@@ -426,10 +425,9 @@ int sun8i_ss_des3_setkey(struct crypto_s
 		kfree(op->key);
 	}
 	op->keylen = keylen;
-	op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA);
+	op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
 	if (!op->key)
 		return -ENOMEM;
-	memcpy(op->key, key, keylen);

 	crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
 	crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [cryptodev:master 9/38] drivers/crypto/ccree/cc_cipher.c:629:15-22: WARNING opportunity for kmemdep
@ 2018-02-15 16:40 kbuild test robot
  2018-02-15 16:40 ` [PATCH] crypto: fix memdup.cocci warnings kbuild test robot
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2018-02-15 16:40 UTC (permalink / raw)
  To: Gilad Ben-Yossef; +Cc: kbuild-all, linux-crypto, Herbert Xu

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head:   a43a34845a156c9e1dae00e33595a508d53e0365
commit: 63ee04c8b491ee148489347e7da9fbfd982ca2bb [9/38] crypto: ccree - add skcipher support


coccinelle warnings: (new ones prefixed by >>)

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

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-08 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
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 ` [PATCH] crypto: fix memdup.cocci warnings kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).