public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Alex Thorlton <athorlton@sgi•com>
To: Chen Gang <gang.chen@asianux•com>
Cc: Peter Zijlstra <peterz@infradead•org>,
	Rusty Russell <rusty@rustcorp•com.au>, Robin Holt <holt@sgi•com>,
	Al Viro <viro@zeniv•linux.org.uk>,
	Andrew Morton <akpm@linux-foundation•org>,
	linux-next@vger•kernel.org
Subject: Re: [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer.
Date: Mon, 7 Oct 2013 11:35:29 -0500	[thread overview]
Message-ID: <20131007163529.GB2860@sgi.com> (raw)
In-Reply-To: <5250354F.4020506@asianux.com>

On Sat, Oct 05, 2013 at 11:50:39PM +0800, Chen Gang wrote:
> sizeof("Tainted: ") already counts '\0', and after first sprintf(), 's'
> will start from the current string end (its' value is '\0').
> 
> So need not add additional 1 byte for maximized usage of 'buf' in
> print_tainted().
>

Looks fine to me; nothing too crazy going on here.  By the way, Robin
isn't with us here at SGI any more.  He's at Cray, now, but I don't know
his e-mail there :/
 
> 
> Signed-off-by: Chen Gang <gang.chen@asianux•com>
> ---
>  kernel/panic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/panic.c b/kernel/panic.c
> index b6c482c..c00b4ce 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -233,7 +233,7 @@ static const struct tnt tnts[] = {
>   */
>  const char *print_tainted(void)
>  {
> -	static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ") + 1];
> +	static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ")];
>  
>  	if (tainted_mask) {
>  		char *s;
> -- 
> 1.7.7.6

  parent reply	other threads:[~2013-10-07 16:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 15:50 [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer Chen Gang
2013-10-05 15:53 ` Chen Gang
2013-10-07 16:35 ` Alex Thorlton [this message]
2013-10-07 21:04   ` Chen Gang
2013-10-08  0:27 ` Andrew Morton
2013-10-08  0:32   ` Al Viro
2013-10-08  1:10   ` Chen Gang
2013-10-08  1:25     ` Andrew Morton
2013-10-08  1:45       ` Chen Gang

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=20131007163529.GB2860@sgi.com \
    --to=athorlton@sgi$(echo .)com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=gang.chen@asianux$(echo .)com \
    --cc=holt@sgi$(echo .)com \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=peterz@infradead$(echo .)org \
    --cc=rusty@rustcorp$(echo .)com.au \
    --cc=viro@zeniv$(echo .)linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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