public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Andrew <nick@nick-andrew.net>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk: Remember the message level for multi-line	output
Date: Sun, 13 Apr 2008 02:42:16 +1000	[thread overview]
Message-ID: <20080412164215.GC29599@tull.net> (raw)
In-Reply-To: <20080412161733.24882.30930.stgit@marcab.local.tull.net>

On Sun, Apr 13, 2008 at 02:18:54AM +1000, Nick Andrew wrote:
> -	static int log_level_unknown = 1;
> +	static int new_text_line = 1;

Further to the previous patch, maintaining the state of being in the
middle of an output line across calls to printk() opens up the
possibility of log corruption when calling code uses printk() to
output fragments of a line. This seems to happen a lot in the
codebase, for example (from arch/blackfin/kernel/traps.c):

        printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
        for (i = 0; i < kstack_depth_to_print; i++) {
                if (stack + 1 > endstack)
                        break;
                if (i % 8 == 0)
                        printk("\n" KERN_NOTICE "       ");
                printk(" %08lx", *stack++);
        }
        printk("\n");

The caller should be building complete output lines, at a minimum.
Or, to maintain the convenient coding, there would need to be an
intermediate function which buffers the partial lines until the
caller issues a flush call.

Nick.

  reply	other threads:[~2008-04-12 16:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-12 16:18 [PATCH] printk: Remember the message level for multi-line output Nick Andrew
2008-04-12 16:42 ` Nick Andrew [this message]
2008-04-13  7:40 ` Ingo Molnar
2008-04-13 11:34   ` Nick Andrew
2008-04-13 11:57     ` Nick Andrew

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=20080412164215.GC29599@tull.net \
    --to=nick@nick-andrew.net \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox