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

Signed-off-by: Horia Geantă <horia.gea...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to