From 3e6e5cf804ab763726236f6aa6b5702a333f265d Mon Sep 17 00:00:00 2001 From: Victoria Milhoan Date: Wed, 5 Nov 2014 05:13:05 -0700 Subject: [PATCH] MLK-9710-8 tcrypt: change memory allocation for test_ahash_speed output buffer Change allocation of the tcrypt module's test_ahash_speed() output buffer to use kmalloc(). This avoids a segmentation fault when the buffer is used in a dma_map_*() call. Signed-off-by: Victoria Milhoan (cherry picked from commit 3c8c56d1bd82433af6a565d183bdb632fd01a13a) --- crypto/tcrypt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 0d9003ae8c61..94d2a3b59881 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -917,7 +917,8 @@ static void test_ahash_speed(const char *algo, unsigned int sec, struct tcrypt_result tresult; struct ahash_request *req; struct crypto_ahash *tfm; - static char output[1024]; + const int output_size = 1024; + char *output = kmalloc(output_size, GFP_KERNEL); int i, ret; printk(KERN_INFO "\ntesting speed of async %s\n", algo); @@ -929,9 +930,9 @@ static void test_ahash_speed(const char *algo, unsigned int sec, return; } - if (crypto_ahash_digestsize(tfm) > sizeof(output)) { + if (crypto_ahash_digestsize(tfm) > output_size) { pr_err("digestsize(%u) > outputbuffer(%zu)\n", - crypto_ahash_digestsize(tfm), sizeof(output)); + crypto_ahash_digestsize(tfm), output_size); goto out; } -- 2.39.5