Skip to content

Commit

Permalink
[CRYPTO] cryptd: Correct kzalloc error test
Browse files Browse the repository at this point in the history
Normally, kzalloc returns NULL or a valid pointer value, not a value to be
tested using IS_ERR.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Julia Lawall authored and herbertx committed May 1, 2008
1 parent 46f8153 commit b1145ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/cryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b1145ce

Please sign in to comment.