]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] Fix csumpartial corner case
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 10 Nov 2005 11:40:53 +0000 (11:40 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 10 Nov 2005 11:40:53 +0000 (11:40 +0000)
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>
arch/arm/lib/csumpartial.S

index cb5e3708f118bcf9b01d65ffa9deac1381b2561f..fe797cf320bb488646d187c041452deac0223a14 100644 (file)
@@ -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
@@ -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