diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-08-16 17:17:30 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-08-16 17:17:30 +0200 |
commit | d244b6bd41e09ecbb09c738cc2c108be227398c8 (patch) | |
tree | 848c6a8a0d6f83929daf43d63e241dc8072066ac /kernel/trace/trace.c | |
parent | Linux 2.6.36-rc1 (diff) | |
parent | tracing: Sanitize value returned from write(trace_marker, "...", len) (diff) | |
download | linux-d244b6bd41e09ecbb09c738cc2c108be227398c8.tar.xz linux-d244b6bd41e09ecbb09c738cc2c108be227398c8.zip |
Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into trace/tip/perf/urgent-4
Conflicts:
kernel/trace/trace_events.c
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ba14a22be4cc..9ec59f541156 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3463,6 +3463,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *fpos) { char *buf; + size_t written; if (tracing_disabled) return -EINVAL; @@ -3484,11 +3485,15 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, } else buf[cnt] = '\0'; - cnt = mark_printk("%s", buf); + written = mark_printk("%s", buf); kfree(buf); - *fpos += cnt; + *fpos += written; - return cnt; + /* don't tell userspace we wrote more - it might confuse them */ + if (written > cnt) + written = cnt; + + return written; } static int tracing_clock_show(struct seq_file *m, void *v) |