diff options
| author | Mark Brown <broonie@kernel.org> | 2026-09-07 13:11:46 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-07 13:11:46 +0100 |
| commit | 8041f30d04b5e1d7d07d0f75a08b8a613fd21beb (patch) | |
| tree | 66c12cd5806a81677b32216dfb8f4c9720d8547f /init | |
| parent | f6959766f41fe25c183a209af500b60646fdc4f6 (diff) | |
| parent | 136ebbeb1c6040f2739ac4a9e0f704395faaf64f (diff) | |
| download | linux-next-8041f30d04b5e1d7d07d0f75a08b8a613fd21beb.tar.gz linux-next-8041f30d04b5e1d7d07d0f75a08b8a613fd21beb.zip | |
Merge branch 'mm-nonmm-unstable' of https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Diffstat (limited to 'init')
| -rw-r--r-- | init/Kconfig | 19 | ||||
| -rw-r--r-- | init/main.c | 8 | ||||
| -rw-r--r-- | init/version.c | 11 |
3 files changed, 28 insertions, 10 deletions
diff --git a/init/Kconfig b/init/Kconfig index 8583d9f06c52..3b141ba427d5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -231,9 +231,10 @@ config BROKEN_ON_SMP default y config INIT_ENV_ARG_LIMIT - int + int "Maximum number of kernel command line arguments" default 32 if !UML default 128 if UML + range 32 4096 help Maximum of each of the number of arguments and environment variables passed to init from the kernel command line. @@ -1614,6 +1615,22 @@ config CMDLINE_FROM_BOOTCONFIG If unsure, say N. +config COMMAND_LINE_SIZE + int "Maximum size of kernel command line" + default 4096 if S390 || LOONGARCH || MIPS || UML + default 2048 if X86 || ARM64 || PPC || SPARC64 || RISCV + default 1024 if ARM || PARISC + default 256 if ALPHA || ARC || M68K || MICROBLAZE || SPARC32 || XTENSA + default 512 + range 896 1048576 if S390 + range 256 2048 if ARM || M68K || NIOS2 || PPC + range 256 3840 if SUPERH + range 256 256 if ALPHA + range 256 4096 + help + This allows you to specify the maximum length of the kernel command + line. + config CMDLINE_LOG_WRAP_IDEAL_LEN int "Length to try to wrap the cmdline when logged at boot" default 1021 diff --git a/init/main.c b/init/main.c index c05e63b8ea06..81404eafe168 100644 --- a/init/main.c +++ b/init/main.c @@ -543,12 +543,12 @@ static int __init unknown_bootoption(char *param, char *val, /* Environment option */ unsigned int i; for (i = 0; envp_init[i]; i++) { + if (!strncmp(param, envp_init[i], len+1)) + break; if (i == MAX_INIT_ENVS) { panic_later = "env"; panic_param = param; } - if (!strncmp(param, envp_init[i], len+1)) - break; } envp_init[i] = param; } else { @@ -576,7 +576,7 @@ static int __init init_setup(char *str) * the shell think it should execute a script with such name. * So we ignore all arguments entered _before_ init=... [MJ] */ - for (i = 1; i < MAX_INIT_ARGS; i++) + for (i = 1; i <= MAX_INIT_ARGS; i++) argv_init[i] = NULL; return 1; } @@ -589,7 +589,7 @@ static int __init rdinit_setup(char *str) ramdisk_execute_command = str; ramdisk_execute_command_set = true; /* See "auto" comment in init_setup */ - for (i = 1; i < MAX_INIT_ARGS; i++) + for (i = 1; i <= MAX_INIT_ARGS; i++) argv_init[i] = NULL; return 1; } diff --git a/init/version.c b/init/version.c index 94c96f6fbfe6..cbae11b6f768 100644 --- a/init/version.c +++ b/init/version.c @@ -21,13 +21,14 @@ static int __init early_hostname(char *arg) { size_t bufsize = sizeof(init_uts_ns.name.nodename); size_t maxlen = bufsize - 1; - ssize_t arglen; - arglen = strscpy(init_uts_ns.name.nodename, arg, bufsize); - if (arglen < 0) { - pr_warn("hostname parameter exceeds %zd characters and will be truncated", + if (!arg) + return -EINVAL; + + if (strscpy(init_uts_ns.name.nodename, arg, bufsize) < 0) + pr_warn("hostname parameter exceeds %zu characters and will be truncated\n", maxlen); - } + return 0; } early_param("hostname", early_hostname); |
