From d903bca9bc542bd6d60019f9f761be15ad79c956 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Mon, 8 Jul 2013 12:21:47 +0100 Subject: metag: checksum.h: fix carry in csum_tcpudp_nofold In csum_tcpudp_nofold, add 1 if the carry bit is set after adding the destination IP address (32 bits) to the checksum (16 bits). The lack of carry handling for this particular addition meant that a destination address of *.*.255.255 (e.g. certain broadcasts) sometimes resulted in an incorrect checksum. This bug has been present in the Meta port since the code was written in the 2.4 days. Reported-by: Marcin Nowakowski Signed-off-by: James Hogan --- arch/metag/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/metag') diff --git a/arch/metag/include/asm/checksum.h b/arch/metag/include/asm/checksum.h index 999bf761a732..08dd1cc65799 100644 --- a/arch/metag/include/asm/checksum.h +++ b/arch/metag/include/asm/checksum.h @@ -64,7 +64,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __wsum sum) { unsigned long len_proto = (proto + len) << 8; - asm ("ADD %0, %0, %1\n" + asm ("ADDS %0, %0, %1\n" + "ADDCS %0, %0, #1\n" "ADDS %0, %0, %2\n" "ADDCS %0, %0, #1\n" "ADDS %0, %0, %3\n" -- cgit v1.2.3