kernel: bump 4.14 to 4.14.154
[openwrt/staging/wigyori.git] / target / linux / brcm63xx / patches-4.19 / 150-MIPS-bmips-mark-exception-vectors-as-char-arrays.patch
1 From badf0fc9f7dc72d06a47357123c7d97dc45792f5 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Tue, 15 Oct 2019 23:27:10 +0200
4 Subject: [PATCH v2] MIPS: bmips: mark exception vectors as char arrays
5
6 The vectors span more than one byte, so mark them as arrays.
7
8 Fixes the following build error when building when using GCC 8.3:
9
10 In file included from ./include/linux/string.h:19,
11 from ./include/linux/bitmap.h:9,
12 from ./include/linux/cpumask.h:12,
13 from ./arch/mips/include/asm/processor.h:15,
14 from ./arch/mips/include/asm/thread_info.h:16,
15 from ./include/linux/thread_info.h:38,
16 from ./include/asm-generic/preempt.h:5,
17 from ./arch/mips/include/generated/asm/preempt.h:1,
18 from ./include/linux/preempt.h:81,
19 from ./include/linux/spinlock.h:51,
20 from ./include/linux/mmzone.h:8,
21 from ./include/linux/bootmem.h:8,
22 from arch/mips/bcm63xx/prom.c:10:
23 arch/mips/bcm63xx/prom.c: In function 'prom_init':
24 ./arch/mips/include/asm/string.h:162:11: error: '__builtin_memcpy' forming offset [2, 32] is out of the bounds [0, 1] of object 'bmips_smp_movevec' with type 'char' [-Werror=array-bounds]
25 __ret = __builtin_memcpy((dst), (src), __len); \
26 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
28 memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
29 ^~~~~~
30 In file included from arch/mips/bcm63xx/prom.c:14:
31 ./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
32 extern char bmips_smp_movevec;
33
34 Fixes: 18a1eef92dcd ("MIPS: BMIPS: Introduce bmips.h")
35 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
36 ---
37
38 v1 -> v2:
39 * Actually update the callers as well, to not break the build in a
40 different way.
41
42 arch/mips/bcm63xx/prom.c | 2 +-
43 arch/mips/include/asm/bmips.h | 10 +++++-----
44 arch/mips/kernel/smp-bmips.c | 8 ++++----
45 3 files changed, 10 insertions(+), 10 deletions(-)
46
47 --- a/arch/mips/bcm63xx/prom.c
48 +++ b/arch/mips/bcm63xx/prom.c
49 @@ -84,7 +84,7 @@ void __init prom_init(void)
50 * Here we will start up CPU1 in the background and ask it to
51 * reconfigure itself then go back to sleep.
52 */
53 - memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
54 + memcpy((void *)0xa0000200, bmips_smp_movevec, 0x20);
55 __sync();
56 set_c0_cause(C_SW0);
57 cpumask_set_cpu(1, &bmips_booted_mask);
58 --- a/arch/mips/include/asm/bmips.h
59 +++ b/arch/mips/include/asm/bmips.h
60 @@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops
61 #endif
62 }
63
64 -extern char bmips_reset_nmi_vec;
65 -extern char bmips_reset_nmi_vec_end;
66 -extern char bmips_smp_movevec;
67 -extern char bmips_smp_int_vec;
68 -extern char bmips_smp_int_vec_end;
69 +extern char bmips_reset_nmi_vec[];
70 +extern char bmips_reset_nmi_vec_end[];
71 +extern char bmips_smp_movevec[];
72 +extern char bmips_smp_int_vec[];
73 +extern char bmips_smp_int_vec_end[];
74
75 extern int bmips_smp_enabled;
76 extern int bmips_cpu_offset;
77 --- a/arch/mips/kernel/smp-bmips.c
78 +++ b/arch/mips/kernel/smp-bmips.c
79 @@ -457,10 +457,10 @@ static void bmips_wr_vec(unsigned long d
80
81 static inline void bmips_nmi_handler_setup(void)
82 {
83 - bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
84 - &bmips_reset_nmi_vec_end);
85 - bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec,
86 - &bmips_smp_int_vec_end);
87 + bmips_wr_vec(BMIPS_NMI_RESET_VEC, bmips_reset_nmi_vec,
88 + bmips_reset_nmi_vec_end);
89 + bmips_wr_vec(BMIPS_WARM_RESTART_VEC, bmips_smp_int_vec,
90 + bmips_smp_int_vec_end);
91 }
92
93 struct reset_vec_info {