misc:cryptodev: Fix USE_AFTER_FREE coverity errors
Shravani Dingari [Mon, 18 May 2015 04:54:59 +0000 (09:54 +0530)]
Fix coverity errors due to dereferencing freed
pointer ctx
Coverity id : 30088

Bug 1416640

Change-Id: I20ebb3d05ced4b7b5d1ce31315a4570e619e80fa
Signed-off-by: Shravani Dingari <shravanid@nvidia.com>
Reviewed-on: http://git-master/r/743598
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>

drivers/misc/tegra-cryptodev.c

index 44adc66..a305808 100644 (file)
@@ -105,8 +105,9 @@ static int tegra_crypto_dev_open(struct inode *inode, struct file *filp)
        if (IS_ERR(ctx->aes_tfm[TEGRA_CRYPTO_CBC])) {
                pr_err("Failed to load transform for cbc-aes-tegra: %ld\n",
                        PTR_ERR(ctx->aes_tfm[TEGRA_CRYPTO_CBC]));
+               ret = PTR_ERR(ctx->aes_tfm[TEGRA_CRYPTO_CBC]);
                kfree(ctx);
-               return PTR_ERR(ctx->aes_tfm[TEGRA_CRYPTO_CBC]);
+               return ret;
        }
 
        filp->private_data = ctx;