From 83688aec17bf3203d8477a9dd7cce88132950798 Mon Sep 17 00:00:00 2001 From: Mianhan Liu Date: Mon, 20 Sep 2021 19:58:31 +0800 Subject: [PATCH 1/2] net/ipv4/xfrm4_tunnel.c: remove superfluous header files from xfrm4_tunnel.c xfrm4_tunnel.c hasn't use any macro or function declared in mutex.h and ip.h Thus, these files can be removed from xfrm4_tunnel.c safely without affecting the compilation of the net module. Signed-off-by: Mianhan Liu Signed-off-by: Steffen Klassert --- net/ipv4/xfrm4_tunnel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c index f4555a88f86b..9d4f418f1bf8 100644 --- a/net/ipv4/xfrm4_tunnel.c +++ b/net/ipv4/xfrm4_tunnel.c @@ -8,9 +8,7 @@ #include #include -#include #include -#include #include static int ipip_output(struct xfrm_state *x, struct sk_buff *skb) From ad57dae8a64da3926a22debbbe7d3b487a685a08 Mon Sep 17 00:00:00 2001 From: luo penghao Date: Thu, 28 Oct 2021 02:36:39 +0000 Subject: [PATCH 2/2] xfrm: Remove redundant fields and related parentheses The variable err is not necessary in such places. It should be revmoved for the simplicity of the code. This will cause the double parentheses to be redundant, and the inner parentheses should be deleted. The clang_analyzer complains as follows: net/xfrm/xfrm_input.c:533: warning: net/xfrm/xfrm_input.c:563: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'. Changes in v2: Modify the title, because v2 removes the brackets. Remove extra parentheses. Reported-by: Zeal Robot Signed-off-by: luo penghao Signed-off-by: Steffen Klassert --- net/xfrm/xfrm_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 3df0861d4390..70a8c36f0ba6 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -530,7 +530,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) goto drop; } - if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) { + if (xfrm_parse_spi(skb, nexthdr, &spi, &seq)) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR); goto drop; } @@ -560,7 +560,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) } seq = 0; - if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) { + if (!spi && xfrm_parse_spi(skb, nexthdr, &spi, &seq)) { secpath_reset(skb); XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR); goto drop;