diff options
author | Winston Hudson <winston.hudson@freescale.com> | 2013-07-21 15:18:38 -0700 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-09-17 09:20:53 -0500 |
commit | de9a80b97430163aadc037c3c573fa8a66a5ce03 (patch) | |
tree | 75a7746c8a5e9ea87c870e708a3d74acb9cd94ca /crypto | |
parent | 71d484d9bea9bb6c36287b2dc4f9db09a4138bc7 (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); } |