Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

avr32/lib: fix unaligned memcpy()

memcpy(p, unaligned, 4..) returns (p + num_of_unaligned_by_copied)
instead of p because p is not preserved in the unaligned case.

Noticed by Herbert Xu's superior parameter recycling coding technique
which let the md4 self-test fail on avr32.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>

authored by

Sebastian Andrzej Siewior and committed by
Haavard Skinnemoen
505d62d0 4be3bd78

+12 -3
+12 -3
arch/avr32/lib/memcpy.S
··· 24 24 brne 1f 25 25 26 26 /* At this point, "from" is word-aligned */ 27 - 2: sub r10, 4 28 - mov r9, r12 27 + 2: mov r9, r12 28 + 5: sub r10, 4 29 29 brlt 4f 30 30 31 31 3: ld.w r8, r11++ ··· 59 59 st.b r12++, r8 60 60 ld.ub r8, r11++ 61 61 st.b r12++, r8 62 - rjmp 2b 62 + mov r8, r12 63 + add pc, pc, r9 64 + sub r8, 1 65 + nop 66 + sub r8, 1 67 + nop 68 + sub r8, 1 69 + nop 70 + mov r9, r8 71 + rjmp 5b