* [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold [not found] <1428569028-23762-1-git-send-email-lizf@kernel.org> @ 2015-04-09 8:46 ` lizf 2015-04-09 17:44 ` Karl Beldan 0 siblings, 1 reply; 4+ messages in thread From: lizf @ 2015-04-09 8:46 UTC (permalink / raw) To: stable Cc: linux-kernel, karl beldan, Karl Beldan, Al Viro, Eric Dumazet, Arnd Bergmann, Mike Frysinger, netdev, Eric Dumazet, David S. Miller, Zefan Li From: karl beldan <karl.beldan@gmail.com> 3.4.107-rc1 review patch. If anyone has any objections, please let me know. ------------------ commit 150ae0e94634714b23919f0c333fee28a5b199d5 upstream. The carry from the 64->32bits folding was dropped, e.g with: saddr=0xFFFFFFFF daddr=0xFF0000FF len=0xFFFF proto=0 sum=1, csum_tcpudp_nofold returned 0 instead of 1. Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Mike Frysinger <vapier@gentoo.org> Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Zefan Li <lizefan@huawei.com> --- lib/checksum.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/checksum.c b/lib/checksum.c index 12dceb2..edbf473 100644 --- a/lib/checksum.c +++ b/lib/checksum.c @@ -47,6 +47,15 @@ static inline unsigned short from32to16(unsigned int x) return x; } +static inline u32 from64to32(u64 x) +{ + /* add up 32-bit and 32-bit for 32+c bit */ + x = (x & 0xffffffff) + (x >> 32); + /* add up carry.. */ + x = (x & 0xffffffff) + (x >> 32); + return (u32)x; +} + static unsigned int do_csum(const unsigned char *buff, int len) { int odd; @@ -193,8 +202,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, #else s += (proto + len) << 8; #endif - s += (s >> 32); - return (__force __wsum)s; + return (__force __wsum)from64to32(s); } EXPORT_SYMBOL(csum_tcpudp_nofold); #endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold 2015-04-09 8:46 ` [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold lizf @ 2015-04-09 17:44 ` Karl Beldan 2015-04-09 18:20 ` David Miller 2015-04-10 1:42 ` Zefan Li 0 siblings, 2 replies; 4+ messages in thread From: Karl Beldan @ 2015-04-09 17:44 UTC (permalink / raw) To: lizf Cc: stable, linux-kernel, Karl Beldan, Al Viro, Eric Dumazet, Arnd Bergmann, Mike Frysinger, netdev, Eric Dumazet, David S. Miller, Zefan Li On Thu, Apr 09, 2015 at 04:46:28PM +0800, lizf@kernel.org wrote: > From: karl beldan <karl.beldan@gmail.com> > > 3.4.107-rc1 review patch. If anyone has any objections, please let me know. > > ------------------ > > > commit 150ae0e94634714b23919f0c333fee28a5b199d5 upstream. > Hi Zefan, The above patch introduced a build error for some archs, please consider applying 9ce357795ef208faa0d59894d9d119a7434e37f3 "lib/checksum.c: fix build for generic csum_tcpudp_nofold" as well. Karl ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold 2015-04-09 17:44 ` Karl Beldan @ 2015-04-09 18:20 ` David Miller 2015-04-10 1:42 ` Zefan Li 1 sibling, 0 replies; 4+ messages in thread From: David Miller @ 2015-04-09 18:20 UTC (permalink / raw) To: karl.beldan Cc: lizf, stable, linux-kernel, karl.beldan, viro, eric.dumazet, arnd, vapier, netdev, edumazet, lizefan From: Karl Beldan <karl.beldan@gmail.com> Date: Thu, 9 Apr 2015 19:44:08 +0200 > On Thu, Apr 09, 2015 at 04:46:28PM +0800, lizf@kernel.org wrote: >> From: karl beldan <karl.beldan@gmail.com> >> >> 3.4.107-rc1 review patch. If anyone has any objections, please let me know. >> >> ------------------ >> >> >> commit 150ae0e94634714b23919f0c333fee28a5b199d5 upstream. >> > > Hi Zefan, > > The above patch introduced a build error for some archs, please consider > applying 9ce357795ef208faa0d59894d9d119a7434e37f3 > "lib/checksum.c: fix build for generic csum_tcpudp_nofold" as well. +1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold 2015-04-09 17:44 ` Karl Beldan 2015-04-09 18:20 ` David Miller @ 2015-04-10 1:42 ` Zefan Li 1 sibling, 0 replies; 4+ messages in thread From: Zefan Li @ 2015-04-10 1:42 UTC (permalink / raw) To: Karl Beldan Cc: lizf, stable, linux-kernel, Karl Beldan, Al Viro, Eric Dumazet, Arnd Bergmann, Mike Frysinger, netdev, Eric Dumazet, David S. Miller On 2015/4/10 1:44, Karl Beldan wrote: > On Thu, Apr 09, 2015 at 04:46:28PM +0800, lizf@kernel.org wrote: >> From: karl beldan <karl.beldan@gmail.com> >> >> 3.4.107-rc1 review patch. If anyone has any objections, please let me know. >> >> ------------------ >> >> >> commit 150ae0e94634714b23919f0c333fee28a5b199d5 upstream. >> > > Hi Zefan, > > The above patch introduced a build error for some archs, please consider > applying 9ce357795ef208faa0d59894d9d119a7434e37f3 > "lib/checksum.c: fix build for generic csum_tcpudp_nofold" as well. > Will fix. Thanks for the review! ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-10 1:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1428569028-23762-1-git-send-email-lizf@kernel.org>
2015-04-09 8:46 ` [PATCH 3.4 140/176] lib/checksum.c: fix carry in csum_tcpudp_nofold lizf
2015-04-09 17:44 ` Karl Beldan
2015-04-09 18:20 ` David Miller
2015-04-10 1:42 ` Zefan Li
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).