Skip to content

Commit

Permalink
crypto: cryptd - Fix uninitialized return value
Browse files Browse the repository at this point in the history
If cryptd_alloc_instance() fails, the return value is uninitialized.
This patch fixes this by setting the return value.

Signed-off-by: Steffen Klassert <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
klassert authored and herbertx committed Jul 15, 2009
1 parent 305f9db commit 05ed875
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/cryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ static int cryptd_create_blkcipher(struct crypto_template *tmpl,
return PTR_ERR(alg);

inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx));
err = PTR_ERR(inst);
if (IS_ERR(inst))
goto out_put_alg;

Expand Down Expand Up @@ -522,6 +523,7 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
alg = &salg->base;
inst = cryptd_alloc_instance(alg, ahash_instance_headroom(),
sizeof(*ctx));
err = PTR_ERR(inst);
if (IS_ERR(inst))
goto out_put_alg;

Expand Down

0 comments on commit 05ed875

Please sign in to comment.