public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kay Sievers <kay@vrfy.org>
Cc: Greg Kroah-Hartmann <greg@kroah.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH RESEND 2/3] kmsg: export printk records to the /dev/kmsg interface
Date: Thu, 10 May 2012 14:45:20 +0300	[thread overview]
Message-ID: <20120510114520.GA10111@mwanda> (raw)
In-Reply-To: <1336004981.4240.10.camel@mop>

On Thu, May 03, 2012 at 02:29:41AM +0200, Kay Sievers wrote:
> +	/* escape non-printable characters */
> +	for (i = 0; i < msg->text_len; i++) {
> +		char c = log_text(msg)[i];
> +
> +		if (c < ' ' || c >= 128)

Signed char type is never larger than 127.

> +			len += sprintf(user->buf + len, "\\x%02x", c);
> +		else
> +			user->buf[len++] = c;
> +	}
> +	user->buf[len++] = '\n';
> +
> +	if (msg->dict_len) {
> +		bool line = true;
> +
> +		for (i = 0; i < msg->dict_len; i++) {
> +			char c = log_dict(msg)[i];
> +
> +			if (line) {
> +				user->buf[len++] = ' ';
> +				line = false;
> +			}
> +
> +			if (c == '\0') {
> +				user->buf[len++] = '\n';
> +				line = true;
> +				continue;
> +			}
> +
> +			if (c < ' ' || c >= 128) {

Same.

> +				len += sprintf(user->buf + len, "\\x%02x", c);
> +				continue;
> +			}
> +

regards,
dan carpenter


  parent reply	other threads:[~2012-05-10 11:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03  0:29 [PATCH RESEND 2/3] kmsg: export printk records to the /dev/kmsg interface Kay Sievers
2012-05-08  0:28 ` Greg Kroah-Hartmann
2012-05-08 16:50   ` Kay Sievers
2012-05-08 17:00     ` Greg Kroah-Hartmann
2012-05-10 11:45 ` Dan Carpenter [this message]
2012-05-10 16:05   ` Linus Torvalds

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=20120510114520.GA10111@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=greg@kroah.com \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox