03027b20165bcd7cd20ba42c610d864980486a24
[openwrt/openwrt.git] / target / linux / zynq / patches-4.19 / 110-ARM-zynq-Use-memcpy_toio-instead-of-memcpy.patch
1 From a801d4aa6000f7ba0ffc5ba9d841af62ec7e0bb1 Mon Sep 17 00:00:00 2001
2 From: Luis Araneda <luaraneda@gmail.com>
3 Date: Tue, 30 Jul 2019 00:29:03 -0400
4 Subject: [RFC PATCH] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
5
6 This fixes a kernel panic (read overflow) on memcpy when
7 FORTIFY_SOURCE is enabled.
8
9 The computed size of memcpy args are:
10 - p_size (dst): 4294967295 = (size_t) -1
11 - q_size (src): 1
12 - size (len): 8
13
14 Additionally, the memory is marked as __iomem, so one of
15 the memcpy_* functions should be used for read/write
16
17 Signed-off-by: Luis Araneda <luaraneda@gmail.com>
18 ---
19 As of 2019-08-03, this patch is under review and waiting
20 comments from the maintainer / author
21 --
22 arch/arm/mach-zynq/platsmp.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25 --- a/arch/arm/mach-zynq/platsmp.c
26 +++ b/arch/arm/mach-zynq/platsmp.c
27 @@ -65,7 +65,7 @@ int zynq_cpun_start(u32 address, int cpu
28 * 0x4: Jump by mov instruction
29 * 0x8: Jumping address
30 */
31 - memcpy((__force void *)zero, &zynq_secondary_trampoline,
32 + memcpy_toio(zero, &zynq_secondary_trampoline,
33 trampoline_size);
34 writel(address, zero + trampoline_size);
35