diff options
author | Winston Hudson <winston.hudson@freescale.com> | 2013-07-21 15:18:38 -0700 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-04-14 14:01:42 -0500 |
commit | 53459111ccfada38f3c02281cc1cfb24c9a979fa (patch) | |
tree | 8660bb4a265b966a22aaaef4e65defb9446c3bcc /crypto | |
parent | e9e7da4fddd55090abf56cb94bec66deec2d4352 (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); } |