linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer.
@ 2013-10-05 15:50 Chen Gang
  2013-10-05 15:53 ` Chen Gang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chen Gang @ 2013-10-05 15:50 UTC (permalink / raw)
  To: Peter Zijlstra, Rusty Russell, Robin Holt, athorlton, Al Viro
  Cc: Andrew Morton, linux-next

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-10-08  1:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).