public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] tracing: fix off-by-one in trace_get_user()
@ 2009-09-22  5:51 Li Zefan
  2009-09-22  5:52 ` [PATCH 2/4] tracing: check the return value of trace_get_user() Li Zefan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Li Zefan @ 2009-09-22  5:51 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, Jiri Olsa, Ingo Molnar, LKML

Leave the last slot for the tailing '\0'.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---

I spent some time reviewing the trace parser patchset,
and found a few small bugs in it, and here are the fixes.

---
 kernel/trace/trace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a35925d..ae17453 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 
 	/* read the non-space input */
 	while (cnt && !isspace(ch)) {
-		if (parser->idx < parser->size)
+		if (parser->idx < parser->size - 1)
 			parser->buffer[parser->idx++] = ch;
 		else {
 			ret = -EINVAL;
-- 
1.6.3


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

end of thread, other threads:[~2009-09-22  8:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-22  5:51 [PATCH 1/4] tracing: fix off-by-one in trace_get_user() Li Zefan
2009-09-22  5:52 ` [PATCH 2/4] tracing: check the return value of trace_get_user() Li Zefan
2009-09-22  8:39   ` [tip:tracing/urgent] tracing: Check " tip-bot for Li Zefan
2009-09-22  5:52 ` [PATCH 3/4] tracing: fix failure path in ftrace_graph_write() Li Zefan
2009-09-22  8:40   ` [tip:tracing/urgent] tracing: Fix " tip-bot for Li Zefan
2009-09-22  5:54 ` [PATCH 4/4] tracing: fix failure path in ftrace_regex_open() Li Zefan
2009-09-22  8:40   ` [tip:tracing/urgent] tracing: Fix " tip-bot for Li Zefan
2009-09-22  8:39 ` [tip:tracing/urgent] tracing: Fix off-by-one in trace_get_user() tip-bot for Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox