提交 af36bef0 编写于 作者: R Russell King 提交者: Russell King

[ARM] Fix csumpartial corner case

Ji-In Park discovered a bug in csumpartial which caused wrong
checksums with misaligned buffers.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 3b44f137
...@@ -39,6 +39,7 @@ td3 .req lr ...@@ -39,6 +39,7 @@ td3 .req lr
/* we must have at least one byte. */ /* we must have at least one byte. */
tst buf, #1 @ odd address? tst buf, #1 @ odd address?
movne sum, sum, ror #8
ldrneb td0, [buf], #1 ldrneb td0, [buf], #1
subne len, len, #1 subne len, len, #1
adcnes sum, sum, td0, put_byte_1 adcnes sum, sum, td0, put_byte_1
...@@ -103,6 +104,9 @@ ENTRY(csum_partial) ...@@ -103,6 +104,9 @@ ENTRY(csum_partial)
cmp len, #8 @ Ensure that we have at least cmp len, #8 @ Ensure that we have at least
blo .less8 @ 8 bytes to copy. blo .less8 @ 8 bytes to copy.
tst buf, #1
movne sum, sum, ror #8
adds sum, sum, #0 @ C = 0 adds sum, sum, #0 @ C = 0
tst buf, #3 @ Test destination alignment tst buf, #3 @ Test destination alignment
blne .not_aligned @ aligh destination, return here blne .not_aligned @ aligh destination, return here
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册