linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
@ 2009-11-07 17:20 Atsushi Nemoto
  2009-11-07 18:16 ` Dmitri Vorobiev
  2009-11-11 13:44 ` Ralf Baechle
  0 siblings, 2 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2009-11-07 17:20 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

Since commit 22242681 ("MIPS: Extend COMMAND_LINE_SIZE"), CL_SIZE is
4096 and local array variables with this size will cause an build
failure with default CONFIG_FRAME_WARN settings.

Although current users of such array variables are all early bootstrap
code and might not cause real stack overflow (thread_info corruption),
it would be safe to declare these arrays static with __initdata.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 arch/mips/bcm47xx/prom.c           |    2 +-
 arch/mips/mti-malta/malta-memory.c |    3 ++-
 arch/mips/rb532/prom.c             |    2 +-
 arch/mips/txx9/generic/setup.c     |    4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 079e33d..fb284c3 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -100,7 +100,7 @@ static __init void prom_init_console(void)
 
 static __init void prom_init_cmdline(void)
 {
-	char buf[CL_SIZE];
+	static char buf[CL_SIZE] __initdata;
 
 	/* Get the kernel command line from CFE */
 	if (cfe_getenv("LINUX_CMDLINE", buf, CL_SIZE) >= 0) {
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 61888ff..9035c64 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -54,7 +54,8 @@ static struct prom_pmemblock * __init prom_getmdesc(void)
 {
 	char *memsize_str;
 	unsigned int memsize;
-	char cmdline[CL_SIZE], *ptr;
+	char *ptr;
+	static char cmdline[CL_SIZE] __initdata;
 
 	/* otherwise look in the environment */
 	memsize_str = prom_getenv("memsize");
diff --git a/arch/mips/rb532/prom.c b/arch/mips/rb532/prom.c
index 46ca24d..ad5bd10 100644
--- a/arch/mips/rb532/prom.c
+++ b/arch/mips/rb532/prom.c
@@ -69,7 +69,7 @@ static inline unsigned long tag2ul(char *arg, const char *tag)
 
 void __init prom_setup_cmdline(void)
 {
-	char cmd_line[CL_SIZE];
+	static char cmd_line[CL_SIZE] __initdata;
 	char *cp, *board;
 	int prom_argc;
 	char **prom_argv, **prom_envp;
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index e10184c..d66802e 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -160,7 +160,7 @@ static void __init prom_init_cmdline(void)
 	int argc;
 	int *argv32;
 	int i;			/* Always ignore the "-c" at argv[0] */
-	char builtin[CL_SIZE];
+	static char builtin[CL_SIZE] __initdata;
 
 	if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) {
 		/*
@@ -315,7 +315,7 @@ static inline void txx9_cache_fixup(void)
 
 static void __init preprocess_cmdline(void)
 {
-	char cmdline[CL_SIZE];
+	static char cmdline[CL_SIZE] __initdata;
 	char *s;
 
 	strcpy(cmdline, arcs_cmdline);
-- 
1.5.6.5

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

* Re: [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
  2009-11-07 17:20 [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata Atsushi Nemoto
@ 2009-11-07 18:16 ` Dmitri Vorobiev
  2009-11-07 19:14   ` Maciej W. Rozycki
  2009-11-08 11:50   ` Atsushi Nemoto
  2009-11-11 13:44 ` Ralf Baechle
  1 sibling, 2 replies; 6+ messages in thread
From: Dmitri Vorobiev @ 2009-11-07 18:16 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, ralf

On Sat, Nov 7, 2009 at 7:20 PM, Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> Since commit 22242681 ("MIPS: Extend COMMAND_LINE_SIZE"), CL_SIZE is
> 4096 and local array variables with this size will cause an build
> failure with default CONFIG_FRAME_WARN settings.
>
> Although current users of such array variables are all early bootstrap
> code and might not cause real stack overflow (thread_info corruption),
> it would be safe to declare these arrays static with __initdata.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
>  arch/mips/bcm47xx/prom.c           |    2 +-
>  arch/mips/mti-malta/malta-memory.c |    3 ++-
>  arch/mips/rb532/prom.c             |    2 +-
>  arch/mips/txx9/generic/setup.c     |    4 ++--
>  4 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
> index 079e33d..fb284c3 100644
> --- a/arch/mips/bcm47xx/prom.c
> +++ b/arch/mips/bcm47xx/prom.c
> @@ -100,7 +100,7 @@ static __init void prom_init_console(void)
>
>  static __init void prom_init_cmdline(void)
>  {
> -       char buf[CL_SIZE];
> +       static char buf[CL_SIZE] __initdata;

If this is intended for -queue, this patch won't apply, because
CL_SIZE was recently removed in favor of using CONFIG_CMDLINE_SIZE
directly.

Also, I think it's more common to place __initdata before the variable
name, not after it, although tastes do differ. :)

Thanks,
Dmitri

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

* Re: [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
  2009-11-07 18:16 ` Dmitri Vorobiev
@ 2009-11-07 19:14   ` Maciej W. Rozycki
  2009-11-07 22:08     ` Dmitri Vorobiev
  2009-11-08 11:50   ` Atsushi Nemoto
  1 sibling, 1 reply; 6+ messages in thread
From: Maciej W. Rozycki @ 2009-11-07 19:14 UTC (permalink / raw)
  To: Dmitri Vorobiev; +Cc: Atsushi Nemoto, linux-mips, ralf

On Sat, 7 Nov 2009, Dmitri Vorobiev wrote:

> Also, I think it's more common to place __initdata before the variable
> name, not after it, although tastes do differ. :)

 Well, <linux/init.h> disagrees.

  Maciej

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

* Re: [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
  2009-11-07 19:14   ` Maciej W. Rozycki
@ 2009-11-07 22:08     ` Dmitri Vorobiev
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitri Vorobiev @ 2009-11-07 22:08 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Atsushi Nemoto, linux-mips, ralf

On Sat, Nov 7, 2009 at 9:14 PM, Maciej W. Rozycki <macro@linux-mips.org> wrote:
> On Sat, 7 Nov 2009, Dmitri Vorobiev wrote:
>
>> Also, I think it's more common to place __initdata before the variable
>> name, not after it, although tastes do differ. :)
>
>  Well, <linux/init.h> disagrees.

Indeed. Thanks for the correction.

Dmitri

>
>  Maciej
>

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

* Re: [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
  2009-11-07 18:16 ` Dmitri Vorobiev
  2009-11-07 19:14   ` Maciej W. Rozycki
@ 2009-11-08 11:50   ` Atsushi Nemoto
  1 sibling, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2009-11-08 11:50 UTC (permalink / raw)
  To: dmitri.vorobiev; +Cc: linux-mips, ralf

On Sat, 7 Nov 2009 20:16:57 +0200, Dmitri Vorobiev <dmitri.vorobiev@gmail.com> wrote:
> > --- a/arch/mips/bcm47xx/prom.c
> > +++ b/arch/mips/bcm47xx/prom.c
> > @@ -100,7 +100,7 @@ static __init void prom_init_console(void)
> >
> >  static __init void prom_init_cmdline(void)
> >  {
> > -       char buf[CL_SIZE];
> > +       static char buf[CL_SIZE] __initdata;
> 
> If this is intended for -queue, this patch won't apply, because
> CL_SIZE was recently removed in favor of using CONFIG_CMDLINE_SIZE
> directly.

Oh I missed your CL_SIZE removal patch.  Anyway I want this patch for
2.6.32 since this is regression.

If the CL_SIZE removal patch was merged for 2.6.32 first, I will
update my patch.  Othersize, your patch needs update, but I suppose we
can do it easily.  Of course Ralf can do it too ;)

---
Atsushi Nemoto

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

* Re: [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata
  2009-11-07 17:20 [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata Atsushi Nemoto
  2009-11-07 18:16 ` Dmitri Vorobiev
@ 2009-11-11 13:44 ` Ralf Baechle
  1 sibling, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2009-11-11 13:44 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Sun, Nov 08, 2009 at 02:20:37AM +0900, Atsushi Nemoto wrote:

> Since commit 22242681 ("MIPS: Extend COMMAND_LINE_SIZE"), CL_SIZE is
> 4096 and local array variables with this size will cause an build
> failure with default CONFIG_FRAME_WARN settings.
> 
> Although current users of such array variables are all early bootstrap
> code and might not cause real stack overflow (thread_info corruption),
> it would be safe to declare these arrays static with __initdata.
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Applied, thanks!

  Ralf

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

end of thread, other threads:[~2009-11-11 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-07 17:20 [PATCH] MIPS: Make local arrays with CL_SIZE static __initdata Atsushi Nemoto
2009-11-07 18:16 ` Dmitri Vorobiev
2009-11-07 19:14   ` Maciej W. Rozycki
2009-11-07 22:08     ` Dmitri Vorobiev
2009-11-08 11:50   ` Atsushi Nemoto
2009-11-11 13:44 ` Ralf Baechle

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