diff options
author | Winston Hudson <winston.hudson@freescale.com> | 2013-07-21 15:18:38 -0700 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-01-15 21:19:54 -0600 |
commit | dfe9d5c564fc8c38f5f079a9e212d7e145469d16 (patch) | |
tree | 6061a02f8ca89851cefc2ea5e5fcdb7c83be6385 /crypto | |
parent | 3e6e5cf804ab763726236f6aa6b5702a333f265d (diff) |
MLK-9710-9 Fix for tcrypt test_ahash_speed function
This patch adds a null pointer check and explicitly frees memory in the
tcrypt.c function test_ahash_speed.
Signed-off-by: Winston Hudson <winston.hudson@freescale.com>
(cherry picked from commit 9bea544c31565260e5cbec2da14f4b2e89d21656)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/tcrypt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 94d2a3b59881..c58f9068dcaa 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -921,12 +921,18 @@ static void test_ahash_speed(const char *algo, unsigned int sec, char *output = kmalloc(output_size, GFP_KERNEL); int i, ret; + if (!output) { + printk(KERN_INFO "\nUnable to allocate output buffer memory\n"); + return; + } + printk(KERN_INFO "\ntesting speed of async %s\n", algo); tfm = crypto_alloc_ahash(algo, 0, 0); if (IS_ERR(tfm)) { pr_err("failed to load transform for %s: %ld\n", algo, PTR_ERR(tfm)); + kfree(output); return; } @@ -976,6 +982,7 @@ static void test_ahash_speed(const char *algo, unsigned int sec, ahash_request_free(req); out: + kfree(output); crypto_free_ahash(tfm); } |