* [PATCH v3 2/2] riscv: memcpy: check src and dst before copy
@ 2023-01-04 1:56 Rick Chen
2023-01-31 15:00 ` Leo Liang
0 siblings, 1 reply; 2+ messages in thread
From: Rick Chen @ 2023-01-04 1:56 UTC (permalink / raw)
To: samuel, ycliang, rick, rickchen36; +Cc: u-boot
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>
---
Changes in v3
- new patch: separate from [1/2]
---
arch/riscv/lib/memcpy.S | 2 ++
1 file changed, 2 insertions(+)
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:
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3 2/2] riscv: memcpy: check src and dst before copy
2023-01-04 1:56 [PATCH v3 2/2] riscv: memcpy: check src and dst before copy Rick Chen
@ 2023-01-31 15:00 ` Leo Liang
0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2023-01-31 15:00 UTC (permalink / raw)
To: Rick Chen; +Cc: samuel, rickchen36, u-boot
On Wed, Jan 04, 2023 at 09:56:28AM +0800, Rick Chen wrote:
> 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>
> ---
> Changes in v3
> - new patch: separate from [1/2]
> ---
> arch/riscv/lib/memcpy.S | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-31 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 1:56 [PATCH v3 2/2] riscv: memcpy: check src and dst before copy Rick Chen
2023-01-31 15:00 ` Leo Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox