From 3c235a337e205da0f614e456be72881483dcde6e Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Tue, 22 Sep 2009 13:51:54 +0800 Subject: tracing: Fix off-by-one in trace_get_user() Leave the last slot for the tailing '\0'. Signed-off-by: Li Zefan Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Steven Rostedt LKML-Reference: <4AB865FA.5080801@cn.fujitsu.com> Signed-off-by: Ingo Molnar --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a35925d222ba..ae17453dc0f9 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; -- cgit v1.2.3-58-ga151