Commit 4187e7e9 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'tracing-fixes-for-linus' of...

Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  modules, tracing: Remove stale struct marker signature from module_layout()
  tracing/workqueue: Use %pf in workqueue trace events
  tracing: Fix a comment and a trivial format issue in tracepoint.h
  tracing: Fix failure path in ftrace_regex_open()
  tracing: Fix failure path in ftrace_graph_write()
  tracing: Check the return value of trace_get_user()
  tracing: Fix off-by-one in trace_get_user()
parents 5bb241b3 115e8a28
...@@ -26,7 +26,7 @@ TRACE_EVENT(workqueue_insertion, ...@@ -26,7 +26,7 @@ TRACE_EVENT(workqueue_insertion,
__entry->func = work->func; __entry->func = work->func;
), ),
TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
__entry->thread_pid, __entry->func) __entry->thread_pid, __entry->func)
); );
...@@ -48,7 +48,7 @@ TRACE_EVENT(workqueue_execution, ...@@ -48,7 +48,7 @@ TRACE_EVENT(workqueue_execution,
__entry->func = work->func; __entry->func = work->func;
), ),
TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
__entry->thread_pid, __entry->func) __entry->thread_pid, __entry->func)
); );
......
...@@ -3091,7 +3091,6 @@ void module_layout(struct module *mod, ...@@ -3091,7 +3091,6 @@ void module_layout(struct module *mod,
struct modversion_info *ver, struct modversion_info *ver,
struct kernel_param *kp, struct kernel_param *kp,
struct kernel_symbol *ks, struct kernel_symbol *ks,
struct marker *marker,
struct tracepoint *tp) struct tracepoint *tp)
{ {
} }
......
...@@ -1621,8 +1621,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable) ...@@ -1621,8 +1621,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
if (!ret) { if (!ret) {
struct seq_file *m = file->private_data; struct seq_file *m = file->private_data;
m->private = iter; m->private = iter;
} else } else {
trace_parser_put(&iter->parser);
kfree(iter); kfree(iter);
}
} else } else
file->private_data = iter; file->private_data = iter;
mutex_unlock(&ftrace_regex_lock); mutex_unlock(&ftrace_regex_lock);
...@@ -2202,7 +2204,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, ...@@ -2202,7 +2204,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
struct trace_parser *parser; struct trace_parser *parser;
ssize_t ret, read; ssize_t ret, read;
if (!cnt || cnt < 0) if (!cnt)
return 0; return 0;
mutex_lock(&ftrace_regex_lock); mutex_lock(&ftrace_regex_lock);
...@@ -2216,7 +2218,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, ...@@ -2216,7 +2218,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
parser = &iter->parser; parser = &iter->parser;
read = trace_get_user(parser, ubuf, cnt, ppos); read = trace_get_user(parser, ubuf, cnt, ppos);
if (trace_parser_loaded(parser) && if (read >= 0 && trace_parser_loaded(parser) &&
!trace_parser_cont(parser)) { !trace_parser_cont(parser)) {
ret = ftrace_process_regex(parser->buffer, ret = ftrace_process_regex(parser->buffer,
parser->idx, enable); parser->idx, enable);
...@@ -2552,8 +2554,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, ...@@ -2552,8 +2554,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
size_t cnt, loff_t *ppos) size_t cnt, loff_t *ppos)
{ {
struct trace_parser parser; struct trace_parser parser;
size_t read = 0; ssize_t read, ret;
ssize_t ret;
if (!cnt || cnt < 0) if (!cnt || cnt < 0)
return 0; return 0;
...@@ -2562,29 +2563,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, ...@@ -2562,29 +2563,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out_unlock;
} }
if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out_unlock;
} }
read = trace_get_user(&parser, ubuf, cnt, ppos); read = trace_get_user(&parser, ubuf, cnt, ppos);
if (trace_parser_loaded((&parser))) { if (read >= 0 && trace_parser_loaded((&parser))) {
parser.buffer[parser.idx] = 0; parser.buffer[parser.idx] = 0;
/* we allow only one expression at a time */ /* we allow only one expression at a time */
ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
parser.buffer); parser.buffer);
if (ret) if (ret)
goto out; goto out_free;
} }
ret = read; ret = read;
out:
out_free:
trace_parser_put(&parser); trace_parser_put(&parser);
out_unlock:
mutex_unlock(&graph_lock); mutex_unlock(&graph_lock);
return ret; return ret;
......
...@@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, ...@@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
/* read the non-space input */ /* read the non-space input */
while (cnt && !isspace(ch)) { while (cnt && !isspace(ch)) {
if (parser->idx < parser->size) if (parser->idx < parser->size - 1)
parser->buffer[parser->idx++] = ch; parser->buffer[parser->idx++] = ch;
else { else {
ret = -EINVAL; ret = -EINVAL;
......
...@@ -232,10 +232,9 @@ ftrace_event_write(struct file *file, const char __user *ubuf, ...@@ -232,10 +232,9 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
size_t cnt, loff_t *ppos) size_t cnt, loff_t *ppos)
{ {
struct trace_parser parser; struct trace_parser parser;
size_t read = 0; ssize_t read, ret;
ssize_t ret;
if (!cnt || cnt < 0) if (!cnt)
return 0; return 0;
ret = tracing_update_buffers(); ret = tracing_update_buffers();
...@@ -247,7 +246,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf, ...@@ -247,7 +246,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
read = trace_get_user(&parser, ubuf, cnt, ppos); read = trace_get_user(&parser, ubuf, cnt, ppos);
if (trace_parser_loaded((&parser))) { if (read >= 0 && trace_parser_loaded((&parser))) {
int set = 1; int set = 1;
if (*parser.buffer == '!') if (*parser.buffer == '!')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment