All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Crypto/chcr: Avoid some code duplication
@ 2020-07-12 21:14 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2020-07-12 21:14 UTC (permalink / raw)
  To: ayush.sawal, vinay.yadav, rohitm, herbert, davem
  Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET

The error handling path of 'chcr_authenc_setkey()' is the same as this
error handling code.

So just 'goto out' as done everywhere in the function to simplify the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/crypto/chelsio/chcr_algo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 4c2553672b6f..ba2469008dd9 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -3609,9 +3609,7 @@ static int chcr_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
 	base_hash  = chcr_alloc_shash(max_authsize);
 	if (IS_ERR(base_hash)) {
 		pr_err("chcr : Base driver cannot be loaded\n");
-		aeadctx->enckey_len = 0;
-		memzero_explicit(&keys, sizeof(keys));
-		return -EINVAL;
+		goto out;
 	}
 	{
 		SHASH_DESC_ON_STACK(shash, base_hash);
-- 
2.25.1


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

* [PATCH 1/2] Crypto/chcr: Avoid some code duplication
@ 2020-07-12 21:14 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2020-07-12 21:14 UTC (permalink / raw)
  To: ayush.sawal, vinay.yadav, rohitm, herbert, davem
  Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET

The error handling path of 'chcr_authenc_setkey()' is the same as this
error handling code.

So just 'goto out' as done everywhere in the function to simplify the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/crypto/chelsio/chcr_algo.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 4c2553672b6f..ba2469008dd9 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -3609,9 +3609,7 @@ static int chcr_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
 	base_hash  = chcr_alloc_shash(max_authsize);
 	if (IS_ERR(base_hash)) {
 		pr_err("chcr : Base driver cannot be loaded\n");
-		aeadctx->enckey_len = 0;
-		memzero_explicit(&keys, sizeof(keys));
-		return -EINVAL;
+		goto out;
 	}
 	{
 		SHASH_DESC_ON_STACK(shash, base_hash);
-- 
2.25.1

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

* Re: [PATCH 1/2] Crypto/chcr: Avoid some code duplication
  2020-07-12 21:14 ` Christophe JAILLET
@ 2020-07-13 19:30 ` Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-13 19:30 UTC (permalink / raw)
  To: Christophe Jaillet, linux-crypto
  Cc: kernel-janitors, linux-kernel, Ayush Sawal, David S. Miller,
	Herbert Xu, Rohit Maheshwari, Vinay Kumar Yadav

> The error handling path of 'chcr_authenc_setkey()' is the same as this
> error handling code.

I find this change description improvable.


> So just 'goto out' as done everywhere in the function to simplify the code.

I propose to adjust jump targets a bit more for better exception handling
in this function implementation.

Regards,
Markus

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

* Re: [PATCH 1/2] Crypto/chcr: Avoid some code duplication
@ 2020-07-13 19:30 ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-13 19:30 UTC (permalink / raw)
  To: Christophe Jaillet, linux-crypto
  Cc: kernel-janitors, linux-kernel, Ayush Sawal, David S. Miller,
	Herbert Xu, Rohit Maheshwari, Vinay Kumar Yadav

> The error handling path of 'chcr_authenc_setkey()' is the same as this
> error handling code.

I find this change description improvable.


> So just 'goto out' as done everywhere in the function to simplify the code.

I propose to adjust jump targets a bit more for better exception handling
in this function implementation.

Regards,
Markus

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

* Re: [PATCH 1/2] Crypto/chcr: Avoid some code duplication
  2020-07-12 21:14 ` Christophe JAILLET
@ 2020-07-16 11:56   ` Herbert Xu
  -1 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2020-07-16 11:56 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ayush.sawal, vinay.yadav, rohitm, davem, linux-crypto,
	linux-kernel, kernel-janitors

On Sun, Jul 12, 2020 at 11:14:04PM +0200, Christophe JAILLET wrote:
> The error handling path of 'chcr_authenc_setkey()' is the same as this
> error handling code.
> 
> So just 'goto out' as done everywhere in the function to simplify the code.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/crypto/chelsio/chcr_algo.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

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] 6+ messages in thread

* Re: [PATCH 1/2] Crypto/chcr: Avoid some code duplication
@ 2020-07-16 11:56   ` Herbert Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2020-07-16 11:56 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ayush.sawal, vinay.yadav, rohitm, davem, linux-crypto,
	linux-kernel, kernel-janitors

On Sun, Jul 12, 2020 at 11:14:04PM +0200, Christophe JAILLET wrote:
> The error handling path of 'chcr_authenc_setkey()' is the same as this
> error handling code.
> 
> So just 'goto out' as done everywhere in the function to simplify the code.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/crypto/chelsio/chcr_algo.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

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] 6+ messages in thread

end of thread, other threads:[~2020-07-16 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 21:14 [PATCH 1/2] Crypto/chcr: Avoid some code duplication Christophe JAILLET
2020-07-12 21:14 ` Christophe JAILLET
2020-07-16 11:56 ` Herbert Xu
2020-07-16 11:56   ` Herbert Xu
2020-07-13 19:30 Markus Elfring
2020-07-13 19:30 ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.