linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] MIPS: bmips: mark exception vectors as char arrays
@ 2019-10-22 19:11 Jonas Gorski
  2019-10-24  3:44 ` Florian Fainelli
  2019-10-24  5:02 ` Paul Burton
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Gorski @ 2019-10-22 19:11 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle, Paul Burton, James Hogan, Florian Fainelli

The vectors span more than one byte, so mark them as arrays.

Fixes the following build error when building when using GCC 8.3:

In file included from ./include/linux/string.h:19,
                 from ./include/linux/bitmap.h:9,
                 from ./include/linux/cpumask.h:12,
                 from ./arch/mips/include/asm/processor.h:15,
                 from ./arch/mips/include/asm/thread_info.h:16,
                 from ./include/linux/thread_info.h:38,
                 from ./include/asm-generic/preempt.h:5,
                 from ./arch/mips/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/bootmem.h:8,
                 from arch/mips/bcm63xx/prom.c:10:
arch/mips/bcm63xx/prom.c: In function 'prom_init':
./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]
   __ret = __builtin_memcpy((dst), (src), __len); \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
   memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
   ^~~~~~
In file included from arch/mips/bcm63xx/prom.c:14:
./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
 extern char bmips_smp_movevec;

Fixes: 18a1eef92dcd ("MIPS: BMIPS: Introduce bmips.h")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---

v1 -> v2:
 * Actually update the callers as well, to not break the build in a
   different way.

 arch/mips/bcm63xx/prom.c      |  2 +-
 arch/mips/include/asm/bmips.h | 10 +++++-----
 arch/mips/kernel/smp-bmips.c  |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index 77a836e661c9..df69eaa453a1 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -84,7 +84,7 @@ void __init prom_init(void)
 		 * Here we will start up CPU1 in the background and ask it to
 		 * reconfigure itself then go back to sleep.
 		 */
-		memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
+		memcpy((void *)0xa0000200, bmips_smp_movevec, 0x20);
 		__sync();
 		set_c0_cause(C_SW0);
 		cpumask_set_cpu(1, &bmips_booted_mask);
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
index bf6a8afd7ad2..581a6a3c66e4 100644
--- a/arch/mips/include/asm/bmips.h
+++ b/arch/mips/include/asm/bmips.h
@@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void)
 #endif
 }
 
-extern char bmips_reset_nmi_vec;
-extern char bmips_reset_nmi_vec_end;
-extern char bmips_smp_movevec;
-extern char bmips_smp_int_vec;
-extern char bmips_smp_int_vec_end;
+extern char bmips_reset_nmi_vec[];
+extern char bmips_reset_nmi_vec_end[];
+extern char bmips_smp_movevec[];
+extern char bmips_smp_int_vec[];
+extern char bmips_smp_int_vec_end[];
 
 extern int bmips_smp_enabled;
 extern int bmips_cpu_offset;
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 76fae9b79f13..712c15de6ab9 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -464,10 +464,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end)
 
 static inline void bmips_nmi_handler_setup(void)
 {
-	bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
-		&bmips_reset_nmi_vec_end);
-	bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec,
-		&bmips_smp_int_vec_end);
+	bmips_wr_vec(BMIPS_NMI_RESET_VEC, bmips_reset_nmi_vec,
+		bmips_reset_nmi_vec_end);
+	bmips_wr_vec(BMIPS_WARM_RESTART_VEC, bmips_smp_int_vec,
+		bmips_smp_int_vec_end);
 }
 
 struct reset_vec_info {
-- 
2.13.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] MIPS: bmips: mark exception vectors as char arrays
  2019-10-22 19:11 [PATCH v2] MIPS: bmips: mark exception vectors as char arrays Jonas Gorski
@ 2019-10-24  3:44 ` Florian Fainelli
  2019-10-24  5:02 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2019-10-24  3:44 UTC (permalink / raw)
  To: Jonas Gorski, linux-mips; +Cc: Ralf Baechle, Paul Burton, James Hogan



On 10/22/2019 12:11 PM, Jonas Gorski wrote:
> The vectors span more than one byte, so mark them as arrays.
> 
> Fixes the following build error when building when using GCC 8.3:
> 
> In file included from ./include/linux/string.h:19,
>                  from ./include/linux/bitmap.h:9,
>                  from ./include/linux/cpumask.h:12,
>                  from ./arch/mips/include/asm/processor.h:15,
>                  from ./arch/mips/include/asm/thread_info.h:16,
>                  from ./include/linux/thread_info.h:38,
>                  from ./include/asm-generic/preempt.h:5,
>                  from ./arch/mips/include/generated/asm/preempt.h:1,
>                  from ./include/linux/preempt.h:81,
>                  from ./include/linux/spinlock.h:51,
>                  from ./include/linux/mmzone.h:8,
>                  from ./include/linux/bootmem.h:8,
>                  from arch/mips/bcm63xx/prom.c:10:
> arch/mips/bcm63xx/prom.c: In function 'prom_init':
> ./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]
>    __ret = __builtin_memcpy((dst), (src), __len); \
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
>    memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
>    ^~~~~~
> In file included from arch/mips/bcm63xx/prom.c:14:
> ./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
>  extern char bmips_smp_movevec;
> 
> Fixes: 18a1eef92dcd ("MIPS: BMIPS: Introduce bmips.h")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] MIPS: bmips: mark exception vectors as char arrays
  2019-10-22 19:11 [PATCH v2] MIPS: bmips: mark exception vectors as char arrays Jonas Gorski
  2019-10-24  3:44 ` Florian Fainelli
@ 2019-10-24  5:02 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-10-24  5:02 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: linux-mips, Ralf Baechle, Paul Burton, James Hogan,
	Florian Fainelli, linux-mips

Hello,

Jonas Gorski wrote:
> The vectors span more than one byte, so mark them as arrays.
> 
> Fixes the following build error when building when using GCC 8.3:
> 
> In file included from ./include/linux/string.h:19,
>                  from ./include/linux/bitmap.h:9,
>                  from ./include/linux/cpumask.h:12,
>                  from ./arch/mips/include/asm/processor.h:15,
>                  from ./arch/mips/include/asm/thread_info.h:16,
>                  from ./include/linux/thread_info.h:38,
>                  from ./include/asm-generic/preempt.h:5,
>                  from ./arch/mips/include/generated/asm/preempt.h:1,
>                  from ./include/linux/preempt.h:81,
>                  from ./include/linux/spinlock.h:51,
>                  from ./include/linux/mmzone.h:8,
>                  from ./include/linux/bootmem.h:8,
>                  from arch/mips/bcm63xx/prom.c:10:
> arch/mips/bcm63xx/prom.c: In function 'prom_init':
> ./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]
>    __ret = __builtin_memcpy((dst), (src), __len); \
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
>    memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
>    ^~~~~~
> In file included from arch/mips/bcm63xx/prom.c:14:
> ./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
>  extern char bmips_smp_movevec;

Applied to mips-fixes.

> commit e4f5cb1a9b27
> https://git.kernel.org/mips/c/e4f5cb1a9b27
> 
> Fixes: 18a1eef92dcd ("MIPS: BMIPS: Introduce bmips.h")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Paul Burton <paulburton@kernel.org>

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paulburton@kernel.org to report it. ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-24  5:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 19:11 [PATCH v2] MIPS: bmips: mark exception vectors as char arrays Jonas Gorski
2019-10-24  3:44 ` Florian Fainelli
2019-10-24  5:02 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).