[PATCH 0/2] init: fix array boundary bugs in boot parameter parsing

From: Wilson Felipe Pereira

Date: Tue Aug 18 2026 - 00:54:21 EST


This series fixes two distinct boundary logic edge-case bugs in
`init/main.c` related to parsing boot command-line arguments and
environment variables. Both bugs have been present since the early
git history (Linux-2.6.12-rc2).

1. The first patch fixes an off-by-one error in `init_setup()` where
the final slot of the `argv_init` array was left uncleared. This
allowed a stale kernel parameter to leak into the `init` process's
user-space command line if exactly `MAX_INIT_ARGS` unknown
parameters were passed.

2. The second patch fixes a false-positive kernel panic in
`unknown_bootoption()`. If a user filled the environment variable
array up to its exact limit (32) and then attempted to overwrite
the final variable, the kernel would panic before evaluating
whether it was a harmless duplicate.

Exact QEMU reproduction steps for both edge cases are documented
inside their respective commit descriptions.

Wilson Felipe Pereira (2):
init/main: fix off-by-one in argv_init cleanup
init/main: fix false-positive kernel panic on environment variable
overwrite

init/main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

--
2.55.0.699.gb54405d56f-goog