linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] ipv6/esp6: Remove structure variables and alignment statements
@ 2021-11-04  3:19 cgel.zte
  2021-11-19  8:37 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-04  3:19 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Herbert Xu, David S . Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, netdev, linux-kernel, luo penghao, Zeal Robot

From: luo penghao <luo.penghao@zte.com.cn>

The definition of this variable is just to find the length of the
structure after aligning the structure. The PTR alignment function
is to optimize the size of the structure. In fact, it doesn't seem
to be of much use, because both members of the structure are of
type u32.
So I think that the definition of the variable and the
corresponding alignment can be deleted, the value of extralen can
be directly passed in the size of the structure.

The clang_analyzer complains as follows:

net/ipv6/esp6.c:117:27 warning:

Value stored to 'extra' during its initialization is never read

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
---
 net/ipv6/esp6.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index ed2f061..c35c211 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -114,7 +114,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;
@@ -122,7 +121,7 @@ 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);
 
 	iv = esp_tmp_iv(aead, tmp, extralen);
 	req = esp_tmp_req(aead, iv);
-- 
2.15.2



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

* Re: [PATCH linux-next] ipv6/esp6: Remove structure variables and alignment statements
  2021-11-04  3:19 [PATCH linux-next] ipv6/esp6: Remove structure variables and alignment statements cgel.zte
@ 2021-11-19  8:37 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2021-11-19  8:37 UTC (permalink / raw)
  To: cgel.zte
  Cc: Herbert Xu, David S . Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, netdev, linux-kernel, luo penghao, Zeal Robot

On Thu, Nov 04, 2021 at 03:19:31AM +0000, cgel.zte@gmail.com wrote:
> From: luo penghao <luo.penghao@zte.com.cn>
> 
> The definition of this variable is just to find the length of the
> structure after aligning the structure. The PTR alignment function
> is to optimize the size of the structure. In fact, it doesn't seem
> to be of much use, because both members of the structure are of
> type u32.
> So I think that the definition of the variable and the
> corresponding alignment can be deleted, the value of extralen can
> be directly passed in the size of the structure.
> 
> The clang_analyzer complains as follows:
> 
> net/ipv6/esp6.c:117:27 warning:
> 
> Value stored to 'extra' during its initialization is never read
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: luo penghao <luo.penghao@zte.com.cn>

Applied to ipsec-next, thanks!

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

end of thread, other threads:[~2021-11-19  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04  3:19 [PATCH linux-next] ipv6/esp6: Remove structure variables and alignment statements cgel.zte
2021-11-19  8:37 ` 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).