mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Mack <daniel@caiaq.de>
Subject: [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size
Date: Mon, 23 Mar 2009 17:10:37 +0100	[thread overview]
Message-ID: <1237824637-28190-1-git-send-email-daniel@caiaq.de> (raw)

In kernel/trace/trace_functions_graph.c, print_graph_duration(), len can
be as low as 1 or 2, which could make snprintf() write beyond the
buffer bounds. (Found by cppcheck, no real-world bug occured)

Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
 kernel/trace/trace_functions_graph.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 930c08e..7533b25 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -281,7 +281,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s)
 	unsigned long nsecs_rem = do_div(duration, 1000);
 	/* log10(ULONG_MAX) + '\0' */
 	char msecs_str[21];
-	char nsecs_str[5];
+	char nsecs_str[8];
 	int ret, len;
 	int i;
 
-- 
1.6.2


             reply	other threads:[~2009-03-23 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 16:10 Daniel Mack [this message]
2009-03-23 16:40 ` Frederic Weisbecker
2009-03-23 16:57   ` Daniel Mack
2009-03-23 16:42 ` [tip:tracing/ftrace] " Daniel Mack
2009-03-23 16:47   ` Frederic Weisbecker
2009-03-23 17:15     ` Ingo Molnar

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=1237824637-28190-1-git-send-email-daniel@caiaq.de \
    --to=daniel@caiaq.de \
    --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

Powered by JetHome