From: Chen Gang <gang.chen@asianux•com>
To: Peter Zijlstra <peterz@infradead•org>,
Rusty Russell <rusty@rustcorp•com.au>, Robin Holt <holt@sgi•com>,
athorlton@sgi•com, Al Viro <viro@zeniv•linux.org.uk>
Cc: 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: Sat, 05 Oct 2013 23:53:37 +0800 [thread overview]
Message-ID: <52503601.50208@asianux.com> (raw)
In-Reply-To: <5250354F.4020506@asianux.com>
Hello Al Viro:
How about 2nd patch, is it correct?
I have finished my 2 patches which for an evaluation by you. ;-)
Thanks.
On 10/05/2013 11:50 PM, 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().
>
>
> 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;
>
--
Chen Gang
next prev parent reply other threads:[~2013-10-05 15:54 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 [this message]
2013-10-07 16:35 ` Alex Thorlton
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=52503601.50208@asianux.com \
--to=gang.chen@asianux$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=athorlton@sgi$(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