From patchwork Fri Jul 9 13:24:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Xiang X-Patchwork-Id: 472262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69E79C07E9C for ; Fri, 9 Jul 2021 13:24:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52CB0611B0 for ; Fri, 9 Jul 2021 13:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232477AbhGIN1A (ORCPT ); Fri, 9 Jul 2021 09:27:00 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:58939 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232333AbhGIN1A (ORCPT ); Fri, 9 Jul 2021 09:27:00 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R131e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e01424; MF=hsiangkao@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0UfDrTKB_1625837049; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UfDrTKB_1625837049) by smtp.aliyun-inc.com(127.0.0.1); Fri, 09 Jul 2021 21:24:15 +0800 From: Gao Xiang To: stable Cc: Greg Kroah-Hartman , Gao Xiang , kernel test robot Subject: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'" Date: Fri, 9 Jul 2021 21:24:08 +0800 Message-Id: <20210709132408.174206-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream. 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""). This isn't a problem for v5.10+ since commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10.y, so only v5.4.y is effected. This partially cherry-picks the memmove part of commit a510b616131f to fix the reported build issue for v5.4.y stable only. Hopefully kernelci could also double check this. [1] https://lore.kernel.org/r/202107070120.6dOj1kB7-lkp@intel.com/ Fixes: defcc2b5e54a ("lib/lz4: explicitly support in-place decompression") # 5.4.y Reported-by: kernel test robot Signed-off-by: Gao Xiang --- not sure if the stable-only patch format is like this, it partially cherry-picks the useful memmove part of commit a510b616131f to fix the build issue found by randconfig fuzz only. arch/mips/boot/compressed/string.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c index 43beecc3587c..e9ab7ea592ba 100644 --- a/arch/mips/boot/compressed/string.c +++ b/arch/mips/boot/compressed/string.c @@ -27,3 +27,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; +}