[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87h7owd9lv.fsf@jogness.linutronix.de>
Date: Tue, 08 Dec 2020 08:51:32 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH next v3 3/3] printk: remove logbuf_lock protection for ringbuffer
On 2020-12-07, John Ogness <john.ogness@...utronix.de> wrote:
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index e1f068677a74..f3c0fcc3163f 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
[...]
> int vprintk_store(int facility, int level,
> const struct dev_printk_info *dev_info,
> const char *fmt, va_list args)
> {
> const u32 caller_id = printk_caller_id();
> - static char textbuf[LOG_LINE_MAX];
> struct prb_reserved_entry e;
> enum log_flags lflags = 0;
> struct printk_record r;
> u16 trunc_msg_len = 0;
> - char *text = textbuf;
> + char prefix_buf[8];
> + va_list args2;
> u16 text_len;
> + int ret = 0;
> u64 ts_nsec;
>
> /*
> @@ -1884,35 +1951,21 @@ int vprintk_store(int facility, int level,
> */
> ts_nsec = local_clock();
>
> + va_copy(args2, args);
> +
> /*
> * The printf needs to come first; we need the syslog
> * prefix which might be passed-in as a parameter.
> */
> - text_len = vscnprintf(text, sizeof(textbuf), fmt, args);
> + text_len = vsnprintf(&prefix_buf[0], sizeof(prefix_buf), fmt, args) + 1;
> + if (text_len > CONSOLE_LOG_MAX)
> + text_len = CONSOLE_LOG_MAX;
LOG_LINE_MAX should be the limit. That was the size of the static
@textbuf.
John Ogness
Powered by blists - more mailing lists