[PATCH] lib/checksum.c: fix carry in csum_tcpudp_nofold

From: Karl Beldan
Date: Tue Jan 27 2015 - 10:25:58 EST


The carry from the 64->32bits folding was dropped, e.g with:
saddr=0xFFFFFFFF daddr=0xFF0000FF len=0xFFFF proto=0 sum=1

Signed-off-by: Karl Beldan <karl.beldan@xxxxxxxxxxxxxxxx>
Cc: Mike Frysinger <vapier@xxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: Stable <stable@xxxxxxxxxxxxxxx>
---
lib/checksum.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/checksum.c b/lib/checksum.c
index 129775e..4b5adf2 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -195,8 +195,8 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
#else
s += (proto + len) << 8;
#endif
- s += (s >> 32);
- return (__force __wsum)s;
+ s += (s << 32) + (s >> 32);
+ return (__force __wsum)(s >> 32);
}
EXPORT_SYMBOL(csum_tcpudp_nofold);
#endif
--
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/