android_kernel_motorola_sm6225/arch/powerpc
Nathan Lynch c5a6526711 powerpc/rtas: use memmove for potentially overlapping buffer copy
[ Upstream commit 271208ee5e335cb1ad280d22784940daf7ddf820 ]

Using memcpy() isn't safe when buf is identical to rtas_err_buf, which
can happen during boot before slab is up. Full context which may not
be obvious from the diff:

	if (altbuf) {
		buf = altbuf;
	} else {
		buf = rtas_err_buf;
		if (slab_is_available())
			buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
	}
	if (buf)
		memcpy(buf, rtas_err_buf, RTAS_ERROR_LOG_MAX);

This was found by inspection and I'm not aware of it causing problems
in practice. It appears to have been introduced by commit
033ef338b6 ("powerpc: Merge rtas.c into arch/powerpc/kernel"); the
old ppc64 version of this code did not have this problem.

Use memmove() instead.

Fixes: 033ef338b6 ("powerpc: Merge rtas.c into arch/powerpc/kernel")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230220-rtas-queue-for-6-4-v1-2-010e4416f13f@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-17 11:13:18 +02:00
..
boot powerpc: dts: t208x: Disable 10G on MAC1 and MAC2 2023-02-25 11:51:50 +01:00
configs vgacon: remove software scrollback support 2020-09-17 13:45:29 +02:00
crypto powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
include powerpc/mm: Switch obsolete dssall to .long 2022-06-25 11:49:17 +02:00
kernel powerpc/rtas: use memmove for potentially overlapping buffer copy 2023-05-17 11:13:18 +02:00
kvm KVM: PPC: Fix vmx/vsx mixup in mmio emulation 2022-04-15 14:14:47 +02:00
lib powerpc/lib/sstep: Fix build errors with newer binutils 2022-04-15 14:14:56 +02:00
math-emu powerpc/math_emu/efp: Include module.h 2022-10-26 13:19:34 +02:00
mm powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E 2022-08-25 11:15:33 +02:00
net powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC 2021-11-26 11:36:17 +01:00
oprofile
perf powerpc/hv-gpci: Fix hv_gpci event list 2023-01-18 11:30:31 +01:00
platforms powerpc/wii: fix resource printk format warnings 2023-05-17 11:13:18 +02:00
purgatory powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
sysdev powerpc/sysdev/tsi108: fix resource printk format warnings 2023-05-17 11:13:18 +02:00
tools powerpc/tools: Don't quote $objdump in scripts 2020-01-04 19:12:42 +01:00
xmon powerpc/xmon: Change printk() to pr_cont() 2020-12-30 11:26:12 +01:00
Kconfig powerpc: Fix HAVE_HARDLOCKUP_DETECTOR_ARCH build configuration 2021-05-22 10:59:35 +02:00
Kconfig.debug powerpc: iommu: fix build when neither PCI or IBMVIO is set 2021-05-22 10:59:35 +02:00
Makefile powerpc: Remove linker flag from KBUILD_AFLAGS 2023-03-11 16:31:44 +01:00
Makefile.postlink