aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/csumpartial.S
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-10 06:40:53 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-10 06:40:53 -0500
commitaf36bef0c5bb82f361ebb2f106f11d0f63dac887 (patch)
treec8fcea1482c15fefc07044e2ff2a77a54310fb19 /arch/arm/lib/csumpartial.S
parent3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff)
[ARM] Fix csumpartial corner case
Ji-In Park discovered a bug in csumpartial which caused wrong checksums with misaligned buffers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib/csumpartial.S')
-rw-r--r--arch/arm/lib/csumpartial.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/lib/csumpartial.S b/arch/arm/lib/csumpartial.S
index cb5e3708f118..fe797cf320bb 100644
--- a/arch/arm/lib/csumpartial.S
+++ b/arch/arm/lib/csumpartial.S
@@ -39,6 +39,7 @@ td3 .req lr
39 39
40 /* we must have at least one byte. */ 40 /* we must have at least one byte. */
41 tst buf, #1 @ odd address? 41 tst buf, #1 @ odd address?
42 movne sum, sum, ror #8
42 ldrneb td0, [buf], #1 43 ldrneb td0, [buf], #1
43 subne len, len, #1 44 subne len, len, #1
44 adcnes sum, sum, td0, put_byte_1 45 adcnes sum, sum, td0, put_byte_1
@@ -103,6 +104,9 @@ ENTRY(csum_partial)
103 cmp len, #8 @ Ensure that we have at least 104 cmp len, #8 @ Ensure that we have at least
104 blo .less8 @ 8 bytes to copy. 105 blo .less8 @ 8 bytes to copy.
105 106
107 tst buf, #1
108 movne sum, sum, ror #8
109
106 adds sum, sum, #0 @ C = 0 110 adds sum, sum, #0 @ C = 0
107 tst buf, #3 @ Test destination alignment 111 tst buf, #3 @ Test destination alignment
108 blne .not_aligned @ aligh destination, return here 112 blne .not_aligned @ aligh destination, return here