diff options
author | Rick Chen <rick@andestech.com> | 2023-01-04 04:56:28 +0300 |
---|---|---|
committer | Leo Yu-Chi Liang <ycliang@andestech.com> | 2023-02-01 11:17:45 +0300 |
commit | 3c60e59a4f540ae28dc51a4044f9733169cd7081 (patch) | |
tree | 9b29b00382d54a141e2b74369a1f53de1d0affe4 /arch | |
parent | 5b71b7bf92dd12dfb768180fc25ab4616f077642 (diff) | |
download | u-boot-3c60e59a4f540ae28dc51a4044f9733169cd7081.tar.xz |
riscv: memcpy: check src and dst before copy
Add src and dst address checking, if they
are the same address, just return and don't
copy data anymore.
Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/riscv/lib/memcpy.S | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/riscv/lib/memcpy.S b/arch/riscv/lib/memcpy.S index 00672c19ad..9884077c93 100644 --- a/arch/riscv/lib/memcpy.S +++ b/arch/riscv/lib/memcpy.S @@ -9,6 +9,7 @@ /* void *memcpy(void *, const void *, size_t) */ ENTRY(__memcpy) WEAK(memcpy) + beq a0, a1, .copy_end /* Save for return value */ mv t6, a0 @@ -121,6 +122,7 @@ WEAK(memcpy) 2: mv a0, t6 +.copy_end: ret .Lmisaligned_word_copy: |