This is a note to let you know that I've just added the patch titled MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'" to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mips-fix-mipsel-linux-ld-decompress.c-undefined-reference-to-memmove.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From hsiangkao@xxxxxxxxxxxxxxxxx Thu Jul 15 15:22:55 2021 From: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Date: Thu, 15 Jul 2021 21:08:06 +0800 Subject: MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'" To: stable <stable@xxxxxxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>, kernel test robot <lkp@xxxxxxxxx> Message-ID: <20210715130806.195223-1-hsiangkao@xxxxxxxxxxxxxxxxx> From: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> This is _not_ an upstream commit and just for 5.4.y only. kernel test robot reported a 5.4.y build issue found by randconfig [1] after backporting commit 89b158635ad7 ("lib/lz4: explicitly support in-place decompression"") due to "undefined reference to `memmove'". However, upstream and 5.10 LTS seem fine. After digging further, I found commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") introduced memmove() occasionally and it has been included since v5.10. This partially cherry-picks the memmove() part of commit a510b616131f to fix the reported build regression since we don't need the whole patch for 5.4 LTS at all. [1] https://lore.kernel.org/r/202107070120.6dOj1kB7-lkp@xxxxxxxxx/ Fixes: defcc2b5e54a ("lib/lz4: explicitly support in-place decompression") # 5.4.y Reported-by: kernel test robot <lkp@xxxxxxxxx> Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/boot/compressed/string.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/arch/mips/boot/compressed/string.c +++ b/arch/mips/boot/compressed/string.c @@ -5,6 +5,7 @@ * Very small subset of simple string routines */ +#include <linux/compiler_attributes.h> #include <linux/types.h> void *memcpy(void *dest, const void *src, size_t n) @@ -27,3 +28,19 @@ void *memset(void *s, int c, size_t n) ss[i] = c; return s; } + +void * __weak memmove(void *dest, const void *src, size_t n) +{ + unsigned int i; + const char *s = src; + char *d = dest; + + if ((uintptr_t)dest < (uintptr_t)src) { + for (i = 0; i < n; i++) + d[i] = s[i]; + } else { + for (i = n; i > 0; i--) + d[i - 1] = s[i - 1]; + } + return dest; +} Patches currently in stable-queue which might be from hsiangkao@xxxxxxxxxxxxxxxxx are queue-5.4/mips-fix-mipsel-linux-ld-decompress.c-undefined-reference-to-memmove.patch