diff options
author | Victoria Milhoan <vicki.milhoan@freescale.com> | 2014-11-05 05:13:05 -0700 |
---|---|---|
committer | Victoria Milhoan <vicki.milhoan@freescale.com> | 2014-11-07 14:53:33 -0700 |
commit | 52c0fe0ed0f2f18b0bf9f8af0b0a0ffdaf6ad66a (patch) | |
tree | d835980be93ecdaa82f52cb68265f64323c1afdb /crypto | |
parent | 69b731af9509d5a1c5031c172002e2af95630308 (diff) |
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 <vicki.milhoan@freescale.com>
(cherry picked from commit 3c8c56d1bd82433af6a565d183bdb632fd01a13a)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/tcrypt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 570b21b5d1b5..e1111d7faf75 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -652,7 +652,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); @@ -664,9 +665,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; } |