Commit 05ed8758fa30e088766905d0d600aa393e144353

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 305f9db22d

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>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

... ... @@ -303,6 +303,7 @@
303 303 return PTR_ERR(alg);
304 304  
305 305 inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx));
  306 + err = PTR_ERR(inst);
306 307 if (IS_ERR(inst))
307 308 goto out_put_alg;
308 309  
... ... @@ -522,6 +523,7 @@
522 523 alg = &salg->base;
523 524 inst = cryptd_alloc_instance(alg, ahash_instance_headroom(),
524 525 sizeof(*ctx));
  526 + err = PTR_ERR(inst);
525 527 if (IS_ERR(inst))
526 528 goto out_put_alg;
527 529