linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher()
@ 2017-01-13  6:59 Horia Geantă
  2017-01-13  8:46 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Horia Geantă @ 2017-01-13  6:59 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, linux-crypto

Fix the "DMA-API: device driver maps memory from stack" warning
generated when crypto accelerators map the IV.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 crypto/testmgr.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 500a5277cc22..64245aeef634 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1081,12 +1081,16 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
 	const char *e, *d;
 	struct tcrypt_result result;
 	void *data;
-	char iv[MAX_IVLEN];
+	char *iv;
 	char *xbuf[XBUFSIZE];
 	char *xoutbuf[XBUFSIZE];
 	int ret = -ENOMEM;
 	unsigned int ivsize = crypto_skcipher_ivsize(tfm);
 
+	iv = kmalloc(MAX_IVLEN, GFP_KERNEL);
+	if (!iv)
+		return ret;
+
 	if (testmgr_alloc_buf(xbuf))
 		goto out_nobuf;
 
@@ -1328,6 +1332,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
 out_nooutbuf:
 	testmgr_free_buf(xbuf);
 out_nobuf:
+	kfree(iv);
 	return ret;
 }
 
-- 
2.4.4

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

end of thread, other threads:[~2017-03-09  4:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13  6:59 [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher() Horia Geantă
2017-01-13  8:46 ` Herbert Xu
2017-03-08 13:04   ` Horia Geantă
2017-03-09  4:18     ` Herbert Xu

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).