Skip to content

Commit

Permalink
[ARM] Fix csumpartial corner case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King authored and Russell King committed Nov 10, 2005
1 parent 3b44f13 commit af36bef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm/lib/csumpartial.S
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ td3 .req lr

/* we must have at least one byte. */
tst buf, #1 @ odd address?
movne sum, sum, ror #8
ldrneb td0, [buf], #1
subne len, len, #1
adcnes sum, sum, td0, put_byte_1
Expand Down Expand Up @@ -103,6 +104,9 @@ ENTRY(csum_partial)
cmp len, #8 @ Ensure that we have at least
blo .less8 @ 8 bytes to copy.

tst buf, #1
movne sum, sum, ror #8

adds sum, sum, #0 @ C = 0
tst buf, #3 @ Test destination alignment
blne .not_aligned @ aligh destination, return here
Expand Down

0 comments on commit af36bef

Please sign in to comment.