Re: "parse_early_param()" and why "tmp_cmdline" must be static?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Robert P. J. Day wrote:

  but (and, admittedly, i haven't finished following this all the way
thru to the end), it's not clear why the temporary copy of that line,
"tmp_cmdline", needs to be static.

Probably because COMMAND_LINE_SIZE is 2048. Allocating 2048 bytes on the stack is a bad idea in the kernel where we can have only 4096 bytes of stack (if CONFIG_4K_STACKS is choosen). Using "static" puts the variable globally (here in the .bss part since it's not initialized).

Sincerly,

Thomas
--
PETAZZONI Thomas - thomas.petazzoni@xxxxxxxx
http://thomas.enix.org - Jabber: thomas.petazzoni@xxxxxxxxx
KOS: http://kos.enix.org/ - SOS: http://sos.enix.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux