public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: Guillaume Chazarain <guichaz@yahoo.fr>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, "Bird, Tim" <Tim.Bird@am.sony.com>
Subject: Re: [-mm PATCH 1/2] printk return value: fix it
Date: Tue, 15 Nov 2005 15:23:24 -0800	[thread overview]
Message-ID: <437A6DEC.4030900@am.sony.com> (raw)
In-Reply-To: <4379D1F7.1000701@yahoo.fr>

Guillaume Chazarain wrote:
> What's the true meaning of the printk return value?
> Should it include the priority prefix length of 3? and what about the
> timing
> information? In both cases it was broken:
> 
> strace -e write echo 1 > /dev/kmsg
> => write(1, "1\n", 2)                      = 5
> strace -e write echo "<1>1" > /dev/kmsg
> => write(1, "<1>1\n", 5)                   = 8
This is clearly a bug, but due to (almost) no one
ever checking the return value, it has gone unnoticed.

> 
> The returned length was "length of input string + 3", I made it "length
> of string output to the log buffer".

I agree with this change.  I think it fits with how
the size is returned from printf in user space,
which can be greater than the length of the format
string when values are replaced in the string.  So
at least for printf, there is a precedent for returning a
number greater than the length of the submitted string.

 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================


  reply	other threads:[~2005-11-15 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-03  9:35 [PATCH] Wrong printk return value Guillaume Chazarain
2005-08-24 16:39 ` Tim Bird
2005-11-15 12:17   ` [-mm PATCH 1/2] printk return value: fix it Guillaume Chazarain
2005-11-15 23:23     ` Tim Bird [this message]
2005-11-15 12:18   ` [PATCH 2/2] kmsg_write: don't return printk return value Guillaume Chazarain

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=437A6DEC.4030900@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=akpm@osdl.org \
    --cc=guichaz@yahoo.fr \
    --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