linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] esp6: remove redundant initialization of esph
@ 2017-10-19 13:09 Colin King
  2017-10-23 11:21 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-10-19 13:09 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S . Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, netdev
  Cc: kernel-janitors, linux-kernel

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

The pointer esph is being initialized with a value that is never
read and then being updated.  Remove the redundant initialization
and move the declaration and initializtion of esph to the local
code block.

Cleans up clang warning:
net/ipv6/esp6.c:562:21: warning: Value stored to 'esph' during its
initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/ipv6/esp6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 89910e2c10f4..1696401fed6c 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -559,14 +559,14 @@ static void esp_input_restore_header(struct sk_buff *skb)
 static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi)
 {
 	struct xfrm_state *x = xfrm_input_state(skb);
-	struct ip_esp_hdr *esph = (struct ip_esp_hdr *)skb->data;
 
 	/* For ESN we move the header forward by 4 bytes to
 	 * accomodate the high bits.  We will move it back after
 	 * decryption.
 	 */
 	if ((x->props.flags & XFRM_STATE_ESN)) {
-		esph = skb_push(skb, 4);
+		struct ip_esp_hdr *esph = skb_push(skb, 4);
+
 		*seqhi = esph->spi;
 		esph->spi = esph->seq_no;
 		esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi;
-- 
2.14.1

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

* Re: [PATCH] esp6: remove redundant initialization of esph
  2017-10-19 13:09 [PATCH] esp6: remove redundant initialization of esph Colin King
@ 2017-10-23 11:21 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2017-10-23 11:21 UTC (permalink / raw)
  To: Colin King
  Cc: Herbert Xu, David S . Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, netdev, kernel-janitors, linux-kernel

On Thu, Oct 19, 2017 at 03:09:47PM +0200, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer esph is being initialized with a value that is never
> read and then being updated.  Remove the redundant initialization
> and move the declaration and initializtion of esph to the local
> code block.
> 
> Cleans up clang warning:
> net/ipv6/esp6.c:562:21: warning: Value stored to 'esph' during its
> initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to ipsec-next, thanks!

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

end of thread, other threads:[~2017-10-23 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 13:09 [PATCH] esp6: remove redundant initialization of esph Colin King
2017-10-23 11:21 ` Steffen Klassert

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).