Skip to content

Commit 05ed875

Browse files
klassertherbertx
authored andcommitted
crypto: cryptd - Fix uninitialized return value
If cryptd_alloc_instance() fails, the return value is uninitialized. This patch fixes this by setting the return value. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 305f9db commit 05ed875

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎crypto/cryptd.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ static int cryptd_create_blkcipher(struct crypto_template *tmpl,
303303
return PTR_ERR(alg);
304304

305305
inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx));
306+
err = PTR_ERR(inst);
306307
if (IS_ERR(inst))
307308
goto out_put_alg;
308309

@@ -522,6 +523,7 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
522523
alg = &salg->base;
523524
inst = cryptd_alloc_instance(alg, ahash_instance_headroom(),
524525
sizeof(*ctx));
526+
err = PTR_ERR(inst);
525527
if (IS_ERR(inst))
526528
goto out_put_alg;
527529

0 commit comments

Comments
 (0)