All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CONFIG_CMDLINE broken on ppc
@ 2004-09-08 13:40 Olaf Hering
  2004-09-08 13:52 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2004-09-08 13:40 UTC (permalink / raw)
  To: Tom Rini, linux-kernel


CONFIG_CMDLINE can not work on ppc.
machine_init() copies the string to cmd_line, then platform_init() is
called. It truncates the string to length zero.



--- ./arch/ppc/kernel/setup.c.kaputt    2004-09-08 14:23:36.000000000 +0200
+++ ./arch/ppc/kernel/setup.c   2004-09-08 15:30:42.000000000 +0200
@@ -418,7 +418,9 @@ platform_init(unsigned long r3, unsigned
         * are used for initrd_start and initrd_size,
         * otherwise they contain 0xdeadbeef.
         */
+#if 0  
        cmd_line[0] = 0;
+#endif 
        if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) {
                strlcpy(cmd_line, (char *)r3 + KERNELBASE,
                        sizeof(cmd_line));


-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

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

* Re: [PATCH] CONFIG_CMDLINE broken on ppc
  2004-09-08 13:40 [PATCH] CONFIG_CMDLINE broken on ppc Olaf Hering
@ 2004-09-08 13:52 ` Tom Rini
  2004-09-08 14:03   ` Olaf Hering
  2004-09-08 15:18   ` Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Rini @ 2004-09-08 13:52 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

On Wed, Sep 08, 2004 at 03:40:28PM +0200, Olaf Hering wrote:

> CONFIG_CMDLINE can not work on ppc.
> machine_init() copies the string to cmd_line, then platform_init() is
> called. It truncates the string to length zero.

This has come up before, actually.  What happens if CMDLINE isn't set,
and we don't terminate cmd_line here?  It's part of the BSS and is
zero'd out anyways?

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

* Re: [PATCH] CONFIG_CMDLINE broken on ppc
  2004-09-08 13:52 ` Tom Rini
@ 2004-09-08 14:03   ` Olaf Hering
  2004-09-08 14:18     ` Tom Rini
  2004-09-08 15:18   ` Andreas Schwab
  1 sibling, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2004-09-08 14:03 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kernel

 On Wed, Sep 08, Tom Rini wrote:

> On Wed, Sep 08, 2004 at 03:40:28PM +0200, Olaf Hering wrote:
> 
> > CONFIG_CMDLINE can not work on ppc.
> > machine_init() copies the string to cmd_line, then platform_init() is
> > called. It truncates the string to length zero.
> 
> This has come up before, actually.  What happens if CMDLINE isn't set,
> and we don't terminate cmd_line here?  It's part of the BSS and is
> zero'd out anyways?

strlcpy generates a null-terminated string, if size != 0. Looks like
that line can go. Or move it at the start of machine_init().

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

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

* Re: [PATCH] CONFIG_CMDLINE broken on ppc
  2004-09-08 14:03   ` Olaf Hering
@ 2004-09-08 14:18     ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2004-09-08 14:18 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

On Wed, Sep 08, 2004 at 04:03:23PM +0200, Olaf Hering wrote:
>  On Wed, Sep 08, Tom Rini wrote:
> 
> > On Wed, Sep 08, 2004 at 03:40:28PM +0200, Olaf Hering wrote:
> > 
> > > CONFIG_CMDLINE can not work on ppc.
> > > machine_init() copies the string to cmd_line, then platform_init() is
> > > called. It truncates the string to length zero.
> > 
> > This has come up before, actually.  What happens if CMDLINE isn't set,
> > and we don't terminate cmd_line here?  It's part of the BSS and is
> > zero'd out anyways?
> 
> strlcpy generates a null-terminated string, if size != 0. Looks like
> that line can go.

... but strlcpy might not be called if no one passes a commandline.
Hence, is this part of the bss and already zeroed ?  If yes, then just
remove the line.

> Or move it at the start of machine_init().

Or always define CMDLINE, ala the ADVANCED_OPTIONS || defaults, no #if's
that way :)

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

* Re: [PATCH] CONFIG_CMDLINE broken on ppc
  2004-09-08 13:52 ` Tom Rini
  2004-09-08 14:03   ` Olaf Hering
@ 2004-09-08 15:18   ` Andreas Schwab
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2004-09-08 15:18 UTC (permalink / raw)
  To: Tom Rini; +Cc: Olaf Hering, linux-kernel

Tom Rini <trini@kernel.crashing.org> writes:

> This has come up before, actually.  What happens if CMDLINE isn't set,
> and we don't terminate cmd_line here?  It's part of the BSS and is
> zero'd out anyways?

If BSS is not cleared that would be a bug.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2004-09-08 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-08 13:40 [PATCH] CONFIG_CMDLINE broken on ppc Olaf Hering
2004-09-08 13:52 ` Tom Rini
2004-09-08 14:03   ` Olaf Hering
2004-09-08 14:18     ` Tom Rini
2004-09-08 15:18   ` Andreas Schwab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.