From: Julia Lawall Date: Tue, 29 Apr 2008 16:27:14 +0000 (+0800) Subject: [CRYPTO] cryptd: Correct kzalloc error test X-Git-Tag: v2.6.26-rc1~24^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1145ce395f7785487c128fe8faf8624e6586d84;p=linux-2.6 [CRYPTO] cryptd: Correct kzalloc error test Normally, kzalloc returns NULL or a valid pointer value, not a value to be tested using IS_ERR. Signed-off-by: Julia Lawall Signed-off-by: Herbert Xu --- diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 250425263e..b150de5620 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -190,8 +190,10 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg, int err; inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); - if (IS_ERR(inst)) + if (!inst) { + inst = ERR_PTR(-ENOMEM); goto out; + } err = -ENAMETOOLONG; if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,