Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

From: Ingo Molnar
Date: Thu Apr 28 2016 - 05:02:25 EST



* Kees Cook <keescook@xxxxxxxxxxxx> wrote:

> Instead of having non-standard memcpy() behavior, explicitly call the new
> function memmove(), make it available to the decompressors, and switch
> the two overlap cases (screen scrolling and ELF parsing) to use memmove().
> Additionally documents the purpose of compressed/string.c.
>
> Suggested-by: Lasse Collin <lasse.collin@xxxxxxxxxxx>
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
> ---
> Applies on top of tip:x86/boot
> ---
> arch/x86/boot/compressed/misc.c | 6 ++++--
> arch/x86/boot/compressed/string.c | 19 +++++++++++--------
> 2 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
> index c57d785ff955..6dde6ccdf00e 100644
> --- a/arch/x86/boot/compressed/misc.c
> +++ b/arch/x86/boot/compressed/misc.c
> @@ -32,9 +32,11 @@
> #undef memcpy
> #undef memset
> #define memzero(s, n) memset((s), 0, (n))
> +#define memmove memmove

Btw., what's the purpose of this define? If it's already defined then we should
get a build warning. If it's not, we won't.

Anyway, applied it, just curious.

Thanks,

Ingo