linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state()
@ 2020-04-30  8:13 Wei Yongjun
  2020-04-30  8:15 ` Stephan Mueller
  2020-05-08  6:06 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2020-04-30  8:13 UTC (permalink / raw)
  To: Herbert Xu, Stephan Mueller; +Cc: Wei Yongjun, linux-crypto, kernel-janitors

Fix to return negative error code -ENOMEM from the kzalloc error handling
case instead of 0, as done elsewhere in this function.

Fixes: db07cd26ac6a ("crypto: drbg - add FIPS 140-2 CTRNG for noise source")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 crypto/drbg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index e57901d8545b..37526eb8c5d5 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1306,8 +1306,10 @@ static inline int drbg_alloc_state(struct drbg_state *drbg)
 	if (IS_ENABLED(CONFIG_CRYPTO_FIPS)) {
 		drbg->prev = kzalloc(drbg_sec_strength(drbg->core->flags),
 				     GFP_KERNEL);
-		if (!drbg->prev)
+		if (!drbg->prev) {
+			ret = -ENOMEM;
 			goto fini;
+		}
 		drbg->fips_primed = false;
 	}




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state()
  2020-04-30  8:13 [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state() Wei Yongjun
@ 2020-04-30  8:15 ` Stephan Mueller
  2020-05-08  6:06 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Stephan Mueller @ 2020-04-30  8:15 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Herbert Xu, linux-crypto, kernel-janitors

Am Donnerstag, 30. April 2020, 10:13:53 CEST schrieb Wei Yongjun:

Hi Wei,

> Fix to return negative error code -ENOMEM from the kzalloc error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: db07cd26ac6a ("crypto: drbg - add FIPS 140-2 CTRNG for noise source")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  crypto/drbg.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index e57901d8545b..37526eb8c5d5 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1306,8 +1306,10 @@ static inline int drbg_alloc_state(struct drbg_state
> *drbg) if (IS_ENABLED(CONFIG_CRYPTO_FIPS)) {
>  		drbg->prev = kzalloc(drbg_sec_strength(drbg->core->flags),
>  				     GFP_KERNEL);
> -		if (!drbg->prev)
> +		if (!drbg->prev) {
> +			ret = -ENOMEM;
>  			goto fini;
> +		}
>  		drbg->fips_primed = false;
>  	}

Thank you

Reviewed-by: Stephan Mueller <smueller@chronox.de>

Ciao
Stephan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state()
  2020-04-30  8:13 [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state() Wei Yongjun
  2020-04-30  8:15 ` Stephan Mueller
@ 2020-05-08  6:06 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2020-05-08  6:06 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Stephan Mueller, linux-crypto, kernel-janitors

On Thu, Apr 30, 2020 at 08:13:53AM +0000, Wei Yongjun wrote:
> Fix to return negative error code -ENOMEM from the kzalloc error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: db07cd26ac6a ("crypto: drbg - add FIPS 140-2 CTRNG for noise source")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  crypto/drbg.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-08  6:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  8:13 [PATCH -next] crypto: drbg - fix error return code in drbg_alloc_state() Wei Yongjun
2020-04-30  8:15 ` Stephan Mueller
2020-05-08  6:06 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).