Re: [PATCH] init: Print out unknown kernel parameters

From: Borislav Petkov
Date: Tue May 04 2021 - 11:00:57 EST


On Mon, May 03, 2021 at 06:46:06PM -0400, Steven Rostedt wrote:
> Note, the issue this is trying to solve is to catch "typos" when someone
> adds a parameter. Perhaps we should add a parameter called "check" and/or a
> config option to always check.

Well, actually, you want this checking to always happen and
unconditionally at that.

The fact that we cannot differentiate between params given to init vs
mistyped params, makes it harder to solve elegantly.

> > > +void print_unknown_bootoptions(void)

static

> > > +{
> > > + const char *const *p;
> > > +
> > > + if (panic_later || (!argv_init[1] && !envp_init[2]))
> > > + return;
> > > +
> > > + pr_notice("Unknown command line parameters:\n");
> > > + for (p = &argv_init[1]; *p; p++)
> > > + pr_notice(" %s\n", *p);
> > > + for (p = &envp_init[2]; *p; p++)
> > > + pr_notice(" %s\n", *p);
> > > +}
>
> Perhaps make this one line, like "Kernel command line:" has.

Yap, only one newline at the end pls.

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg