Patchwork checksum: remove duplicated line of code in csum_fold

login
register
mail settings
Submitter Pablo Neira
Date Feb. 12, 2013, 5:10 p.m.
Message ID <1360689003-21794-1-git-send-email-pablo@netfilter.org>
Download mbox | patch
Permalink /patch/219913/
State Rejected
Delegated to: David Miller
Headers show

Comments

Pablo Neira - Feb. 12, 2013, 5:10 p.m.
From: Pablo Neira Ayuso <pablo@netfilter.org>

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/asm-generic/checksum.h |    1 -
 1 file changed, 1 deletion(-)
David Miller - Feb. 12, 2013, 5:12 p.m.
From: pablo@netfilter.org
Date: Tue, 12 Feb 2013 18:10:03 +0100

> From: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

I am very sure that those two lines are there intentionally.
The first addition one can overflow, therefore we need to
fold again (which cannot overflow).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - Feb. 12, 2013, 5:41 p.m.
On Tue, Feb 12, 2013 at 12:12:35PM -0500, David Miller wrote:
> From: pablo@netfilter.org
> Date: Tue, 12 Feb 2013 18:10:03 +0100
> 
> > From: Pablo Neira Ayuso <pablo@netfilter.org>
> > 
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> I am very sure that those two lines are there intentionally.
> The first addition one can overflow, therefore we need to
> fold again (which cannot overflow).

I was missing that, make sense indeed, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index c084767..f68b2ea 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -51,7 +51,6 @@  static inline __sum16 csum_fold(__wsum csum)
 {
 	u32 sum = (__force u32)csum;
 	sum = (sum & 0xffff) + (sum >> 16);
-	sum = (sum & 0xffff) + (sum >> 16);
 	return (__force __sum16)~sum;
 }