Subject: [PATCH] ipcomp: fix crypto_alloc_comp() error check

From: Akinobu Mita <[email-masked]>
Date: Mon, 27 Nov 2006 14:07:22 +0900

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

Cc: David Miller <[email-masked]>
Cc: Hideaki YOSHIFUJI <[email-masked]>
Signed-off-by: Akinobu Mita <[email-masked]>

---
 net/ipv4/ipcomp.c  |    2 +-
 net/ipv6/ipcomp6.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: work-fault-inject/net/ipv6/ipcomp6.c
===================================================================
--- work-fault-inject.orig/net/ipv6/ipcomp6.c
+++ work-fault-inject/net/ipv6/ipcomp6.c
@@ -368,7 +368,7 @@ static struct crypto_comp **ipcomp6_allo
 	for_each_possible_cpu(cpu) {
 		struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
 							    CRYPTO_ALG_ASYNC);
-		if (!tfm)
+		if (IS_ERR(tfm))
 			goto error;
 		*per_cpu_ptr(tfms, cpu) = tfm;
 	}
Index: work-fault-inject/net/ipv4/ipcomp.c
===================================================================
--- work-fault-inject.orig/net/ipv4/ipcomp.c
+++ work-fault-inject/net/ipv4/ipcomp.c
@@ -369,7 +369,7 @@ static struct crypto_comp **ipcomp_alloc
 	for_each_possible_cpu(cpu) {
 		struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
 							    CRYPTO_ALG_ASYNC);
-		if (!tfm)
+		if (IS_ERR(tfm))
 			goto error;
 		*per_cpu_ptr(tfms, cpu) = tfm;
 	}