diff mbox series

[5.4.y,only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

Message ID 20210709132408.174206-1-hsiangkao@linux.alibaba.com
State New
Headers show
Series [5.4.y,only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'" | expand

Commit Message

Gao Xiang July 9, 2021, 1:24 p.m. UTC
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 <lkp@intel.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
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(+)

Comments

Gao Xiang July 14, 2021, 4:15 p.m. UTC | #1
Hi,

On Fri, Jul 09, 2021 at 09:24:08PM +0800, Gao Xiang wrote:
> 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 <lkp@intel.com>

> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

> ---

> 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.


ping.. are there more things I can do for this?

Thanks,
Gao Xiang

> 

>  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;

> +}

> -- 

> 2.24.4
Greg KH July 15, 2021, 10:52 a.m. UTC | #2
On Fri, Jul 09, 2021 at 09:24:08PM +0800, Gao Xiang wrote:
> commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.


That is not what this commit id is :(

Please fix this up and be more careful.

thanks,

greg k-h
Gao Xiang July 15, 2021, 11:22 a.m. UTC | #3
Hi Greg,

On Thu, Jul 15, 2021 at 12:52:33PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Jul 09, 2021 at 09:24:08PM +0800, Gao Xiang wrote:

> > commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

> 

> That is not what this commit id is :(

> 

> Please fix this up and be more careful.


That's the exact commit, the original upstream commit was named as
"MIPS: Add support for ZSTD-compressed kernels", which contains the
memmove() definition so the upstream / 5.10 LTS kernel is fine.

But for 5.4 LTS, we shouldn't backport the whole patch since only
memmove() part is needed in order to fix the build regression...

Thanks,
Gao Xiang

> 

> thanks,

> 

> greg k-h
Greg KH July 15, 2021, 11:35 a.m. UTC | #4
On Thu, Jul 15, 2021 at 07:22:00PM +0800, Gao Xiang wrote:
> Hi Greg,

> 

> On Thu, Jul 15, 2021 at 12:52:33PM +0200, Greg Kroah-Hartman wrote:

> > On Fri, Jul 09, 2021 at 09:24:08PM +0800, Gao Xiang wrote:

> > > commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

> > 

> > That is not what this commit id is :(

> > 

> > Please fix this up and be more careful.

> 

> That's the exact commit, the original upstream commit was named as

> "MIPS: Add support for ZSTD-compressed kernels", which contains the

> memmove() definition so the upstream / 5.10 LTS kernel is fine.

> 

> But for 5.4 LTS, we shouldn't backport the whole patch since only

> memmove() part is needed in order to fix the build regression...


That was not obvious, and is confusing :(

Please just submit the fix and say _why_ this is not an upstream commit,
do not attempt to emulate an upstream commit like your change did.

thanks,

greg k-h
Gao Xiang July 15, 2021, 12:26 p.m. UTC | #5
On Thu, Jul 15, 2021 at 01:35:39PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Jul 15, 2021 at 07:22:00PM +0800, Gao Xiang wrote:

> > Hi Greg,

> > 

> > On Thu, Jul 15, 2021 at 12:52:33PM +0200, Greg Kroah-Hartman wrote:

> > > On Fri, Jul 09, 2021 at 09:24:08PM +0800, Gao Xiang wrote:

> > > > commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

> > > 

> > > That is not what this commit id is :(

> > > 

> > > Please fix this up and be more careful.

> > 

> > That's the exact commit, the original upstream commit was named as

> > "MIPS: Add support for ZSTD-compressed kernels", which contains the

> > memmove() definition so the upstream / 5.10 LTS kernel is fine.

> > 

> > But for 5.4 LTS, we shouldn't backport the whole patch since only

> > memmove() part is needed in order to fix the build regression...

> 

> That was not obvious, and is confusing :(

> 

> Please just submit the fix and say _why_ this is not an upstream commit,

> do not attempt to emulate an upstream commit like your change did.


Ok, got it. I was confused how to handle such condition as well...
Let me resend it...

Thanks,
Gao Xiang

> 

> thanks,

> 

> greg k-h
diff mbox series

Patch

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;
+}