All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size
@ 2017-11-09  8:54 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2017-11-09  8:54 UTC (permalink / raw)
  To: Harsh Jain, Herbert Xu, David S . Miller, linux-crypto
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Pointer reqctx is assigned the same value twice, once on initialization
and again a few statements later, remove the second redundant assignment.
Variable dst_size is assigned but it is never read, so the variable is
redundant and can be removed. Cleans up clang warnings:

drivers/crypto/chelsio/chcr_algo.c:156:29: warning: Value stored to
'reqctx' during its initialization is never read
drivers/crypto/chelsio/chcr_algo.c:2020:2: warning: Value stored to
'dst_size' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 4eed7171e2ae..300e66fe8a3c 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -160,7 +160,6 @@ static inline void chcr_handle_ahash_resp(struct ahash_request *req,
 
 	if (input == NULL)
 		goto out;
-	reqctx = ahash_request_ctx(req);
 	digestsize = crypto_ahash_digestsize(crypto_ahash_reqtfm(req));
 	if (reqctx->is_sg_map)
 		chcr_hash_dma_unmap(&u_ctx->lldi.pdev->dev, req);
@@ -2014,11 +2013,8 @@ static int chcr_aead_common_init(struct aead_request *req,
 	struct chcr_aead_ctx *aeadctx = AEAD_CTX(a_ctx(tfm));
 	struct chcr_aead_reqctx  *reqctx = aead_request_ctx(req);
 	int error = -EINVAL;
-	unsigned int dst_size;
 	unsigned int authsize = crypto_aead_authsize(tfm);
 
-	dst_size = req->assoclen + req->cryptlen + (op_type ?
-					-authsize : authsize);
 	/* validate key size */
 	if (aeadctx->enckey_len == 0)
 		goto err;
-- 
2.14.1

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

* [PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size
@ 2017-11-09  8:54 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2017-11-09  8:54 UTC (permalink / raw)
  To: Harsh Jain, Herbert Xu, David S . Miller, linux-crypto
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Pointer reqctx is assigned the same value twice, once on initialization
and again a few statements later, remove the second redundant assignment.
Variable dst_size is assigned but it is never read, so the variable is
redundant and can be removed. Cleans up clang warnings:

drivers/crypto/chelsio/chcr_algo.c:156:29: warning: Value stored to
'reqctx' during its initialization is never read
drivers/crypto/chelsio/chcr_algo.c:2020:2: warning: Value stored to
'dst_size' is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 4eed7171e2ae..300e66fe8a3c 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -160,7 +160,6 @@ static inline void chcr_handle_ahash_resp(struct ahash_request *req,
 
 	if (input = NULL)
 		goto out;
-	reqctx = ahash_request_ctx(req);
 	digestsize = crypto_ahash_digestsize(crypto_ahash_reqtfm(req));
 	if (reqctx->is_sg_map)
 		chcr_hash_dma_unmap(&u_ctx->lldi.pdev->dev, req);
@@ -2014,11 +2013,8 @@ static int chcr_aead_common_init(struct aead_request *req,
 	struct chcr_aead_ctx *aeadctx = AEAD_CTX(a_ctx(tfm));
 	struct chcr_aead_reqctx  *reqctx = aead_request_ctx(req);
 	int error = -EINVAL;
-	unsigned int dst_size;
 	unsigned int authsize = crypto_aead_authsize(tfm);
 
-	dst_size = req->assoclen + req->cryptlen + (op_type ?
-					-authsize : authsize);
 	/* validate key size */
 	if (aeadctx->enckey_len = 0)
 		goto err;
-- 
2.14.1


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

* Re: [PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size
  2017-11-09  8:54 ` Colin King
@ 2017-11-29  6:31   ` Herbert Xu
  -1 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2017-11-29  6:31 UTC (permalink / raw)
  To: Colin King
  Cc: Harsh Jain, David S . Miller, linux-crypto, kernel-janitors,
	linux-kernel

On Thu, Nov 09, 2017 at 08:54:13AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer reqctx is assigned the same value twice, once on initialization
> and again a few statements later, remove the second redundant assignment.
> Variable dst_size is assigned but it is never read, so the variable is
> redundant and can be removed. Cleans up clang warnings:
> 
> drivers/crypto/chelsio/chcr_algo.c:156:29: warning: Value stored to
> 'reqctx' during its initialization is never read
> drivers/crypto/chelsio/chcr_algo.c:2020:2: warning: Value stored to
> 'dst_size' is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

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

* Re: [PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size
@ 2017-11-29  6:31   ` Herbert Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2017-11-29  6:31 UTC (permalink / raw)
  To: Colin King
  Cc: Harsh Jain, David S . Miller, linux-crypto, kernel-janitors,
	linux-kernel

On Thu, Nov 09, 2017 at 08:54:13AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer reqctx is assigned the same value twice, once on initialization
> and again a few statements later, remove the second redundant assignment.
> Variable dst_size is assigned but it is never read, so the variable is
> redundant and can be removed. Cleans up clang warnings:
> 
> drivers/crypto/chelsio/chcr_algo.c:156:29: warning: Value stored to
> 'reqctx' during its initialization is never read
> drivers/crypto/chelsio/chcr_algo.c:2020:2: warning: Value stored to
> 'dst_size' is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

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

* [PATCH] crypto: chelsio: remove redundant premature assignment to iv
  2017-11-09  8:54 ` Colin King
@ 2020-05-27 11:29 ` Colin King
  -1 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-05-27 11:29 UTC (permalink / raw)
  To: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari, Herbert Xu,
	David S . Miller, linux-crypto
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable iv is being assigned twice with the same value, the first
assignment is redundant and can be removed and instead keep the
latter assignment of iv as it is closer to the point it is being
used.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/crypto/chelsio/chcr_ipsec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c
index af961dcd317b..f9ad8c93e5ff 100644
--- a/drivers/crypto/chelsio/chcr_ipsec.c
+++ b/drivers/crypto/chelsio/chcr_ipsec.c
@@ -398,7 +398,6 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
 	memset(pos, 0, len);
 	aadiv = (struct chcr_ipsec_aadiv *)pos;
 	esphdr = (struct ip_esp_hdr *)skb_transport_header(skb);
-	iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);
 	xo = xfrm_offload(skb);
 
 	aadiv->spi = (esphdr->spi);
-- 
2.25.1


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

* [PATCH] crypto: chelsio: remove redundant premature assignment to iv
@ 2020-05-27 11:29 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-05-27 11:29 UTC (permalink / raw)
  To: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari, Herbert Xu,
	David S . Miller, linux-crypto
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable iv is being assigned twice with the same value, the first
assignment is redundant and can be removed and instead keep the
latter assignment of iv as it is closer to the point it is being
used.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/crypto/chelsio/chcr_ipsec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c
index af961dcd317b..f9ad8c93e5ff 100644
--- a/drivers/crypto/chelsio/chcr_ipsec.c
+++ b/drivers/crypto/chelsio/chcr_ipsec.c
@@ -398,7 +398,6 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
 	memset(pos, 0, len);
 	aadiv = (struct chcr_ipsec_aadiv *)pos;
 	esphdr = (struct ip_esp_hdr *)skb_transport_header(skb);
-	iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);
 	xo = xfrm_offload(skb);
 
 	aadiv->spi = (esphdr->spi);
-- 
2.25.1

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

* Re: [PATCH] crypto: chelsio: remove redundant premature assignment to iv
  2020-05-27 11:29 ` Colin King
@ 2020-05-27 13:51   ` Ayush Sawal
  -1 siblings, 0 replies; 8+ messages in thread
From: Ayush Sawal @ 2020-05-27 13:39 UTC (permalink / raw)
  To: Colin King, Vinay Kumar Yadav, Rohit Maheshwari, Herbert Xu,
	David S . Miller, linux-crypto
  Cc: ayush.sawal, kernel-janitors, linux-kernel

Hi Colin,

On 5/27/2020 4:59 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable iv is being assigned twice with the same value, the first
> assignment is redundant and can be removed and instead keep the
> latter assignment of iv as it is closer to the point it is being
> used.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/crypto/chelsio/chcr_ipsec.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c
> index af961dcd317b..f9ad8c93e5ff 100644
> --- a/drivers/crypto/chelsio/chcr_ipsec.c
> +++ b/drivers/crypto/chelsio/chcr_ipsec.c
> @@ -398,7 +398,6 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
>   	memset(pos, 0, len);
>   	aadiv = (struct chcr_ipsec_aadiv *)pos;
>   	esphdr = (struct ip_esp_hdr *)skb_transport_header(skb);
> -	iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);
>   	xo = xfrm_offload(skb);
>   
>   	aadiv->spi = (esphdr->spi);

Patch looks good, thank you for correcting.




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

* Re: [PATCH] crypto: chelsio: remove redundant premature assignment to iv
@ 2020-05-27 13:51   ` Ayush Sawal
  0 siblings, 0 replies; 8+ messages in thread
From: Ayush Sawal @ 2020-05-27 13:51 UTC (permalink / raw)
  To: Colin King, Vinay Kumar Yadav, Rohit Maheshwari, Herbert Xu,
	David S . Miller, linux-crypto
  Cc: ayush.sawal, kernel-janitors, linux-kernel

Hi Colin,

On 5/27/2020 4:59 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable iv is being assigned twice with the same value, the first
> assignment is redundant and can be removed and instead keep the
> latter assignment of iv as it is closer to the point it is being
> used.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/crypto/chelsio/chcr_ipsec.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c
> index af961dcd317b..f9ad8c93e5ff 100644
> --- a/drivers/crypto/chelsio/chcr_ipsec.c
> +++ b/drivers/crypto/chelsio/chcr_ipsec.c
> @@ -398,7 +398,6 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
>   	memset(pos, 0, len);
>   	aadiv = (struct chcr_ipsec_aadiv *)pos;
>   	esphdr = (struct ip_esp_hdr *)skb_transport_header(skb);
> -	iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);
>   	xo = xfrm_offload(skb);
>   
>   	aadiv->spi = (esphdr->spi);

Patch looks good, thank you for correcting.

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

end of thread, other threads:[~2020-05-27 13:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 11:29 [PATCH] crypto: chelsio: remove redundant premature assignment to iv Colin King
2020-05-27 11:29 ` Colin King
2020-05-27 13:39 ` Ayush Sawal
2020-05-27 13:51   ` Ayush Sawal
  -- strict thread matches above, loose matches on Subject: below --
2017-11-09  8:54 [PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size Colin King
2017-11-09  8:54 ` Colin King
2017-11-29  6:31 ` Herbert Xu
2017-11-29  6:31   ` Herbert Xu

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.