diff options
author | James Hogan <james.hogan@imgtec.com> | 2013-07-08 07:21:47 -0400 |
---|---|---|
committer | James Hogan <james.hogan@imgtec.com> | 2013-07-09 06:09:17 -0400 |
commit | d903bca9bc542bd6d60019f9f761be15ad79c956 (patch) | |
tree | 510a51eccad4bf34a01cad162179817a0d793af1 | |
parent | 8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff) |
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 <Marcin.Nowakowski@pure.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
-rw-r--r-- | arch/metag/include/asm/checksum.h | 3 |
1 files changed, 2 insertions, 1 deletions
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, | |||
64 | __wsum sum) | 64 | __wsum sum) |
65 | { | 65 | { |
66 | unsigned long len_proto = (proto + len) << 8; | 66 | unsigned long len_proto = (proto + len) << 8; |
67 | asm ("ADD %0, %0, %1\n" | 67 | asm ("ADDS %0, %0, %1\n" |
68 | "ADDCS %0, %0, #1\n" | ||
68 | "ADDS %0, %0, %2\n" | 69 | "ADDS %0, %0, %2\n" |
69 | "ADDCS %0, %0, #1\n" | 70 | "ADDCS %0, %0, #1\n" |
70 | "ADDS %0, %0, %3\n" | 71 | "ADDS %0, %0, %3\n" |