[PATCH] net: Simplify the calculation of variables

Subsystems: networking [general], networking [ipsec], the rest

STALE2025d

2 messages, 2 authors, 2021-01-23 · open the first message on its own page

[PATCH] net: Simplify the calculation of variables

From: Jiapeng Zhong <hidden>
Date: 2021-01-22 08:59:40

Fix the following coccicheck warnings:

 ./net/ipv4/esp4_offload.c:288:32-34: WARNING !A || A && B is
equivalent to !A || B.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Zhong <redacted>
---
 net/ipv4/esp4_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index 5bda5ae..9ba8cc5 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -285,7 +285,7 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb,  netdev_features_
 	esp.esph = ip_esp_hdr(skb);
 
 
-	if (!hw_offload || (hw_offload && !skb_is_gso(skb))) {
+	if (!hw_offload || (!skb_is_gso(skb))) {
 		esp.nfrags = esp_output_head(x, skb, &esp);
 		if (esp.nfrags < 0)
 			return esp.nfrags;
-- 
1.8.3.1

Re: [PATCH] net: Simplify the calculation of variables

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-23 03:28:04

On Fri, 22 Jan 2021 16:57:47 +0800 Jiapeng Zhong wrote:
quoted hunk
Fix the following coccicheck warnings:

 ./net/ipv4/esp4_offload.c:288:32-34: WARNING !A || A && B is
equivalent to !A || B.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Zhong <redacted>
---
 net/ipv4/esp4_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index 5bda5ae..9ba8cc5 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -285,7 +285,7 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb,  netdev_features_
 	esp.esph = ip_esp_hdr(skb);
 
 
-	if (!hw_offload || (hw_offload && !skb_is_gso(skb))) {
+	if (!hw_offload || (!skb_is_gso(skb))) {
You can drop the parenthesis around !skb_is_gso(skb) now.
 		esp.nfrags = esp_output_head(x, skb, &esp);
 		if (esp.nfrags < 0)
 			return esp.nfrags;

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help