From: Rasmus Villemoes Date: Wed, 3 Jan 2024 10:47:03 +0000 (+0100) Subject: cmd/mem.c: use memmove in do_mem_cp() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=d631681e8c5f255938283233cd0f55ed2f9a9a76;p=u-boot.git 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 Signed-off-by: Rasmus Villemoes --- diff --git a/cmd/mem.c b/cmd/mem.c index 66c2d36a14..c696b92a27 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);