Re: [PATCH v2 2/2] printk: Add update_preferred_console()
From: Petr Mladek
Date: Mon Jun 17 2024 - 04:03:28 EST
On Mon 2024-06-17 10:20:57, Tony Lindgren wrote:
> On Fri, Jun 14, 2024 at 07:17:20PM +0200, Petr Mladek wrote:
> > On Thu 2024-06-13 15:51:08, Tony Lindgren wrote:
> > > The earlier attempt on doing this caused a regression with the kernel
> > > command line console order as it added calling __add_preferred_console()
> > > again later on during init. A better approach was suggested by Petr where
> > > we add the deferred console to the console_cmdline[] and update it later
> > > on when the console is ready.
> >
> > > --- a/kernel/printk/printk.c
> > > +++ b/kernel/printk/printk.c
> > > @@ -2486,8 +2495,8 @@ __setup("console_msg_format=", console_msg_format_setup);
> > > */
> > > static int __init console_setup(char *str)
> > > {
> > > - char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for "ttyS" */
> > > - char *s, *options, *brl_options = NULL;
> >
> > I would add
> >
> > static_assert(sizeof(console_cmdline[0].devname) >= sizeof(console_cmdline[0].name));
>
> That check should still be >= sizeof(console_cmdline[0].name) + 4, right?
> For the "number only" consoles we add the "ttyS" prefix.
Right. Great catch!
Best Regards,
Petr