aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2024-01-03 11:47:03 +0100
committerTom Rini <trini@konsulko.com>2024-01-16 17:05:29 -0500
commitd631681e8c5f255938283233cd0f55ed2f9a9a76 (patch)
treed51ec3a709b86a8ef44491dce95a735c447f02f8
parent22efc1cf276c0b0ca5622e4e85135e920b3efa9c (diff)
downloadu-boot-d631681e8c5f255938283233cd0f55ed2f9a9a76.zip
u-boot-d631681e8c5f255938283233cd0f55ed2f9a9a76.tar.gz
u-boot-d631681e8c5f255938283233cd0f55ed2f9a9a76.tar.bz2
cmd/mem.c: use memmove in do_mem_cp()
There's no 'mv' shell command for handling overlapping src and dst regions, and there's no point introducing one, when we can just make the existing 'cp' command DTRT in all cases. memmove() should at most be a few instructions more then memcpy() (to detect the appropriate direction to do the copy), which is of course completely in the noise with all the string processing that a shell command does. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
-rw-r--r--cmd/mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index 66c2d36..c696b92 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -361,7 +361,7 @@ static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
}
#endif
- memcpy(dst, src, count * size);
+ memmove(dst, src, count * size);
unmap_sysmem(src);
unmap_sysmem(dst);