lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Aug 2020 07:17:59 -0400
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <davem@...emloft.net>, <kuba@...nel.org>, <pshelar@....org>,
        <fw@...len.de>, <martin.varghese@...ia.com>, <edumazet@...gle.com>,
        <dcaratti@...hat.com>, <steffen.klassert@...unet.com>,
        <pabeni@...hat.com>, <shmulik@...anetworks.com>,
        <kyk.segfault@...il.com>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH] net: Call ip_hdrlen() when skbuff is not fragment

When skbuff is fragment, we exit immediately and leave ip_hdrlen() as
unused. And remove the unnecessary local variable fragment.

Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 net/core/skbuff.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4dc92290becd..0b24aed04060 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4843,28 +4843,20 @@ static __sum16 *skb_checksum_setup_ip(struct sk_buff *skb,
 static int skb_checksum_setup_ipv4(struct sk_buff *skb, bool recalculate)
 {
 	unsigned int off;
-	bool fragment;
 	__sum16 *csum;
 	int err;
 
-	fragment = false;
-
 	err = skb_maybe_pull_tail(skb,
 				  sizeof(struct iphdr),
 				  MAX_IP_HDR_LEN);
 	if (err < 0)
 		goto out;
 
-	if (ip_is_fragment(ip_hdr(skb)))
-		fragment = true;
-
-	off = ip_hdrlen(skb);
-
 	err = -EPROTO;
-
-	if (fragment)
+	if (ip_is_fragment(ip_hdr(skb)))
 		goto out;
 
+	off = ip_hdrlen(skb);
 	csum = skb_checksum_setup_ip(skb, ip_hdr(skb)->protocol, off);
 	if (IS_ERR(csum))
 		return PTR_ERR(csum);
-- 
2.19.1

Powered by blists - more mailing lists