Skip to contentSkip to conversation

ipsec: Remove unneeded extra variable in esp4 esp_ssg_unref()

PATCH Applied [email protected] 2 participants 2 messages Jul 16, 2021 – Jul 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipsec: Remove unneeded extra variable in esp4 esp_ssg_unref()

From: Corey Minyard <[email protected]>

It's assigned twice, but only used to calculate the size of the structure it points to. Just remove it and take a sizeof the actual structure.

Cc Steffen Klassert <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 net/ipv4/esp4.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv4/esp4.c +1 -3
index a09e36c4a413..851f542928a3 100644
@@ -97,7 +97,6 @@ static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead,
 
 static void esp_ssg_unref(struct xfrm_state *x, void *tmp)
 {
-	struct esp_output_extra *extra = esp_tmp_extra(tmp);
 	struct crypto_aead *aead = x->data;
 	int extralen = 0;
 	u8 *iv;
@@ -105,9 +104,8 @@ static void esp_ssg_unref(struct xfrm_state *x, void *tmp)
 	struct scatterlist *sg;
 
 	if (x->props.flags & XFRM_STATE_ESN)
-		extralen += sizeof(*extra);
+		extralen += sizeof(struct esp_output_extra);
 
-	extra = esp_tmp_extra(tmp);
 	iv = esp_tmp_iv(aead, tmp, extralen);
 	req = esp_tmp_req(aead, iv);
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 11 lines · On Fri, Jul 16, 2021 at 03:28:46PM -0500, [email protected] wrote:

From: Corey Minyard <[email protected]>

It's assigned twice, but only used to calculate the size of the structure it points to. Just remove it and take a sizeof the actual structure.

Cc Steffen Klassert <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>

Applied to ipsec-next, thanks!