All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: John Ogness <john.ogness@linutronix.de>, Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Atish Patra <atishp@atishpatra.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] printk: finalize records with trailing newlines
Date: Thu, 26 Nov 2020 20:32:18 +0800	[thread overview]
Message-ID: <53ab7746-5871-992b-7ab8-853b7c08ae13@huawei.com> (raw)
In-Reply-To: <20201126114836.14750-1-john.ogness@linutronix.de>


On 2020/11/26 19:48, John Ogness wrote:
> Any record with a trailing newline (LOG_NEWLINE flag) cannot
> be continued because the newline has been stripped and will
> not be visible if the message is appended. This was already
> handled correctly when committing in log_output() but was
> not handled correctly when committing in log_store().
>
> Fixes: f5f022e53b87 ("printk: reimplement log_cont using record extension")
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
>   This is an important bugfix for continuous messages and should
>   be part of the 5.10 release.
>
>   If not applied, newlines will vanish when concatenating
>   continuous with trailing newlines.
Thanks for you quick fix.

Reported-and-tested-by:  Kefeng Wang <wangkefeng.wang@huawei.com>

>   kernel/printk/printk.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index fe64a49344bf..bc1e3b5a97bd 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -528,8 +528,8 @@ static int log_store(u32 caller_id, int facility, int level,
>   	if (dev_info)
>   		memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
>   
> -	/* insert message */
> -	if ((flags & LOG_CONT) || !(flags & LOG_NEWLINE))
> +	/* A message without a trailing newline can be continued. */
> +	if (!(flags & LOG_NEWLINE))
>   		prb_commit(&e);
>   	else
>   		prb_final_commit(&e);

  reply	other threads:[~2020-11-26 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 11:48 [PATCH] printk: finalize records with trailing newlines John Ogness
2020-11-26 12:32 ` Kefeng Wang [this message]
2020-11-27 12:39   ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53ab7746-5871-992b-7ab8-853b7c08ae13@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=atishp@atishpatra.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.