]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
tracing: Fix off-by-one in trace_get_user()
authorLi Zefan <lizf@cn.fujitsu.com>
Tue, 22 Sep 2009 05:51:54 +0000 (13:51 +0800)
committerIngo Molnar <mingo@elte.hu>
Tue, 22 Sep 2009 08:28:53 +0000 (10:28 +0200)
Leave the last slot for the tailing '\0'.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4AB865FA.5080801@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c

index a35925d222baa5b8b31f54c86327e605552c1ec9..ae17453dc0f91e4fb49faf0080fed61b92d84818 100644 (file)
@@ -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;