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: [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer.
Date: Sat, 05 Oct 2013 23:50:39 +0800 [thread overview]
Message-ID: <5250354F.4020506@asianux.com> (raw)
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;
--
1.7.7.6
next reply other threads:[~2013-10-05 15:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-05 15:50 Chen Gang [this message]
2013-10-05 15:53 ` [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer Chen Gang
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=5250354F.4020506@asianux.com \
--to=gang.chen@asianux.com \
--cc=akpm@linux-foundation.org \
--cc=athorlton@sgi.com \
--cc=holt@sgi.com \
--cc=linux-next@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rusty@rustcorp.com.au \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.