public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: matthew-lkml@newtoncomputing.co.uk
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Stop printk printing non-printable chars
Date: Sat, 19 Jun 2004 01:03:30 +0100	[thread overview]
Message-ID: <20040619000330.GC5286@newtoncomputing.co.uk> (raw)
In-Reply-To: <20040618213252.GS20632@lug-owl.de>

On Fri, Jun 18, 2004 at 11:32:52PM +0200, Jan-Benedict Glaw wrote:
> On Fri, 2004-06-18 21:53:55 +0100, matthew-lkml@newtoncomputing.co.uk <matthew-lkml@newtoncomputing.co.uk>
> wrote in message <20040618205355.GA5286@newtoncomputing.co.uk>:
> > printk to even consider printing _any_ non-printable characters at all.
> 
> It's dandy if you pump out some data via serial link.

Is printk ever used to send anything out via a serial link? I assumed it
was only kernel log messages (that should really be fairly sane). Log
messages sent to serial printer, etc, don't want dodgy chars in them
that may mess up the printer, do they?

> 
> > It makes all characters out of the range 32..126 (except for newline)
> > print as a '?'.
> 
> I don't see why that's needed. I'd say let's better fix ACPI to put
> those strings as a hexdump or something like that.

Looking at the ACPI code (and not understanding it too well) it looks
like this data is retrieved from the BIOS, but is only printed here for
info and not actually used anywhere. In this case, I'd think there isn't
a lot of point checking for data correctness in the ACPI code. As
someone else pointed out, though, other things can cause the kernel log
to print nasty chars that are unwanted, so there should really be a
check here anyway.

> > +		if (p[0] != '\n' && (p[0] < 32 || p[0] > 126)) {
> 
> So you're ripping off something that could be a nice feature and place
> some slow path. By the way, why do you use 'p[0]' instead of '*p'?

The string has just been through the equivalent of sprintf, so I guess
this is hardly going to slow it down much more. Used p[0] to look
tidier, matching another "if" statement 5 lines up. In new patch used
*p, as it doesn't really matter.

Thanks,

-- 
Matthew

  parent reply	other threads:[~2004-06-19  0:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-18 20:53 [PATCH] Stop printk printing non-printable chars matthew-lkml
2004-06-18 21:08 ` Linus Torvalds
2004-06-18 22:44   ` Jesper Juhl
2004-06-18 23:52     ` matthew-lkml
2004-06-19  4:18       ` Willy Tarreau
2004-06-19 10:27         ` Matthias Urlichs
2004-06-19 23:00       ` Dave Jones
2004-06-19  1:23     ` Matthias Urlichs
2004-06-19  1:43       ` Jesper Juhl
2004-06-19 10:20         ` Matthias Urlichs
2004-06-18 21:32 ` Jan-Benedict Glaw
2004-06-18 21:58   ` Pekka Pietikainen
2004-06-19  0:03   ` matthew-lkml [this message]
2004-06-19  8:31     ` Jan-Benedict Glaw
2004-06-19 11:18 ` David Woodhouse
2004-06-19 15:49   ` matthew-lkml
2004-06-19 16:09     ` Arjan van de Ven
2004-06-20  2:19     ` Horst von Brand
2004-06-20 14:17     ` David Woodhouse
2004-06-20 20:06       ` Jeff Woods
  -- strict thread matches above, loose matches on Subject: below --
2004-06-19 20:12 Albert Cahalan
2004-06-19 22:56 ` Jan-Benedict Glaw
2004-06-20  4:02 Albert Cahalan
2004-06-20  8:38 ` David Woodhouse
2004-06-20  8:49 ` Jan-Benedict Glaw

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=20040619000330.GC5286@newtoncomputing.co.uk \
    --to=matthew-lkml@newtoncomputing.co.uk \
    --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