Message ID | 507dee05e622cc37418b23e5de96b6b449410414.1730133890.git.chris@chrisdown.name |
---|---|
State | New |
Headers | show |
Series | printk: console: Per-console loglevels | expand |
On Mon, Oct 28, 2024 at 04:45:48PM +0000, Chris Down wrote: > Commit 7640f1a44eba ("printk: Add > match_devname_and_update_preferred_console()") adds support for > DEVNAME:n:n style console= registration. It determines whether or not > this is a hardware-addressed console by looking at whether the console= > string has a colon in it. However, this interferes with loglevel:n and > potentially other future named options, which also make use of the > character. > > In order to avoid this, only search positions before options. Looks good to me: Reviewed-by: Tony Lindgren <tony.lindgren@linux.intel.com>
On Mon 2024-10-28 16:45:48, Chris Down wrote: > Commit 7640f1a44eba ("printk: Add > match_devname_and_update_preferred_console()") adds support for > DEVNAME:n:n style console= registration. It determines whether or not > this is a hardware-addressed console by looking at whether the console= > string has a colon in it. However, this interferes with loglevel:n and > potentially other future named options, which also make use of the > character. > > In order to avoid this, only search positions before options. > > Signed-off-by: Chris Down <chris@chrisdown.name> Nice trick! Reviewed-by: Petr Mladek <pmladek@suse.com> Best Regards, Petr
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index bc456f7624d4..bbd037b84a0d 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2670,6 +2670,7 @@ static int __init console_setup(char *str) char *devname = NULL; char *options; char *s; + char *first_delim; int idx; /* @@ -2685,8 +2686,13 @@ static int __init console_setup(char *str) if (_braille_console_setup(&str, &brl_options)) return 1; - /* For a DEVNAME:0.0 style console the character device is unknown early */ - if (strchr(str, ':')) + /* + * For a DEVNAME:0.0 style console the character device is unknown + * early. We must restrict this to before any comma to avoid interfering + * with named options, like "loglevel". + */ + first_delim = strpbrk(str, ":,"); + if (first_delim && *first_delim == ':') devname = buf; else ttyname = buf;
Commit 7640f1a44eba ("printk: Add match_devname_and_update_preferred_console()") adds support for DEVNAME:n:n style console= registration. It determines whether or not this is a hardware-addressed console by looking at whether the console= string has a colon in it. However, this interferes with loglevel:n and potentially other future named options, which also make use of the character. In order to avoid this, only search positions before options. Signed-off-by: Chris Down <chris@chrisdown.name> --- kernel/printk/printk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)