]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Fix for tcrypt test_ahash_speed function.
authorWinston Hudson <b45308@stc-mongo.am.freescale.net>
Sun, 21 Jul 2013 22:18:38 +0000 (15:18 -0700)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:14:16 +0000 (14:14 +0200)
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>
crypto/tcrypt.c

index 6ff34df13b5c37d570db2e89e3d8a4628f8d3f6f..2c1d3ae34161b0a45cd911762f0e6f381241ec58 100644 (file)
@@ -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);
 }