Skip to contentSkip to conversation

CONFIG_CMDLINE broken on ppc

PATCH In review Olaf Hering 3 participants 5 messages Sep 8, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CONFIG_CMDLINE broken on ppc

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 2004-09-08 15:30:42.000000000 +0200 renamed from arch/ppc/kernel/setup.c.kaputt 2004-09-08 14:23:36.000000000 +0200 +2 -0
@@ -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));
Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#1 lore raw
Quoted 3 lines · Olaf Hering

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?

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#2 lore raw
Quoted 9 lines · Tom Rini
Quoted 3 lines · Olaf Hering

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

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Tom Rini
Quoted 3 lines · Olaf Hering

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 1 line

Or move it at the start of machine_init().

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

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#4 lore raw
In reply to Tom Rini
Quoted 3 lines · Tom Rini

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.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
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."