Skip to contentSkip to conversation

ecryptfs: fix crypto_alloc_blkcipher() error check

PATCH New Akinobu Mita 1 participant 1 message Nov 27, 2006 Ecrypt file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ecryptfs: fix crypto_alloc_blkcipher() error check

The return value of crypto_alloc_blkcipher() should be checked by IS_ERR().

Cc Mike Halcrow <[email protected]>
Cc Phillip Hellewell <[email protected]>
---
 fs/ecryptfs/crypto.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ecryptfs/crypto.c +2 -1
Index: work-fault-inject/fs/ecryptfs/crypto.c
===================================================================
@@ -820,7 +820,8 @@ int ecryptfs_init_crypt_ctx(struct ecryp
 	crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0,
 						 CRYPTO_ALG_ASYNC);
 	kfree(full_alg_name);
-	if (!crypt_stat->tfm) {
+	if (IS_ERR(crypt_stat->tfm)) {
+		rc = PTR_ERR(crypt_stat->tfm);
 		ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): "
 				"Error initializing cipher [%s]\n",
 				crypt_stat->cipher);