Skip to content

Commit 4ad9921

Browse files
jognesspmladek
authored andcommitted
printk: finalize records with trailing newlines
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: f5f022e ("printk: reimplement log_cont using record extension") Link: https://lore.kernel.org/r/20201126114836.14750-1-john.ogness@linutronix.de Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: John Ogness <john.ogness@linutronix.de> Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent 8119c43 commit 4ad9921

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/printk/printk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ static int log_store(u32 caller_id, int facility, int level,
528528
if (dev_info)
529529
memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
530530

531-
/* insert message */
532-
if ((flags & LOG_CONT) || !(flags & LOG_NEWLINE))
531+
/* A message without a trailing newline can be continued. */
532+
if (!(flags & LOG_NEWLINE))
533533
prb_commit(&e);
534534
else
535535
prb_final_commit(&e);

0 commit comments

Comments
 (0)