diff options
author | Victoria Milhoan <vicki.milhoan@freescale.com> | 2014-11-05 05:13:05 -0700 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-04-14 14:01:42 -0500 |
commit | e9e7da4fddd55090abf56cb94bec66deec2d4352 (patch) | |
tree | e68b54abaca127bc82fc4fec9bee61f93e5ad075 /crypto | |
parent | bdec62dd79a5c441e624b75dc7b24d6a9d721892 (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 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; } |