summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinston Hudson <b45308@stc-mongo.am.freescale.net>2013-07-21 15:18:38 -0700
committerTerry Lv <r65388@freescale.com>2013-07-25 12:46:34 +0800
commit781e4301e0c4d7a86a198c867164c13ad727837e (patch)
tree64d4343e1cf8c1cb625634cdac9ba473aaa2934f
parent3e048f92c60afd4f04fb90ff86502ef53b331e14 (diff)
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 <b45308@stc-mongo.am.freescale.net>
-rw-r--r--crypto/tcrypt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 6ff34df13b5c..2c1d3ae34161 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -662,12 +662,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;
}
@@ -717,6 +723,7 @@ static void test_ahash_speed(const char *algo, unsigned int sec,
ahash_request_free(req);
out:
+ kfree(output);
crypto_free_ahash(tfm);
}