Skip to content

Commit b1145ce

Browse files
Julia Lawallherbertx
authored andcommitted
[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 <julia@diku.dk> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 46f8153 commit b1145ce

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎crypto/cryptd.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg,
190190
int err;
191191

192192
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
193-
if (IS_ERR(inst))
193+
if (!inst) {
194+
inst = ERR_PTR(-ENOMEM);
194195
goto out;
196+
}
195197

196198
err = -ENAMETOOLONG;
197199
if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,

0 commit comments

Comments
 (0)