diff options
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a35925d222ba..b20d3ec75de9 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, | |||
415 | 415 | ||
416 | /* read the non-space input */ | 416 | /* read the non-space input */ |
417 | while (cnt && !isspace(ch)) { | 417 | while (cnt && !isspace(ch)) { |
418 | if (parser->idx < parser->size) | 418 | if (parser->idx < parser->size - 1) |
419 | parser->buffer[parser->idx++] = ch; | 419 | parser->buffer[parser->idx++] = ch; |
420 | else { | 420 | else { |
421 | ret = -EINVAL; | 421 | ret = -EINVAL; |
@@ -1393,7 +1393,7 @@ int trace_array_vprintk(struct trace_array *tr, | |||
1393 | 1393 | ||
1394 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | 1394 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) |
1395 | { | 1395 | { |
1396 | return trace_array_printk(&global_trace, ip, fmt, args); | 1396 | return trace_array_vprintk(&global_trace, ip, fmt, args); |
1397 | } | 1397 | } |
1398 | EXPORT_SYMBOL_GPL(trace_vprintk); | 1398 | EXPORT_SYMBOL_GPL(trace_vprintk); |
1399 | 1399 | ||
@@ -1949,7 +1949,7 @@ static int s_show(struct seq_file *m, void *v) | |||
1949 | return 0; | 1949 | return 0; |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | static struct seq_operations tracer_seq_ops = { | 1952 | static const struct seq_operations tracer_seq_ops = { |
1953 | .start = s_start, | 1953 | .start = s_start, |
1954 | .next = s_next, | 1954 | .next = s_next, |
1955 | .stop = s_stop, | 1955 | .stop = s_stop, |
@@ -1984,11 +1984,9 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1984 | if (current_trace) | 1984 | if (current_trace) |
1985 | *iter->trace = *current_trace; | 1985 | *iter->trace = *current_trace; |
1986 | 1986 | ||
1987 | if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) | 1987 | if (!zalloc_cpumask_var(&iter->started, GFP_KERNEL)) |
1988 | goto fail; | 1988 | goto fail; |
1989 | 1989 | ||
1990 | cpumask_clear(iter->started); | ||
1991 | |||
1992 | if (current_trace && current_trace->print_max) | 1990 | if (current_trace && current_trace->print_max) |
1993 | iter->tr = &max_tr; | 1991 | iter->tr = &max_tr; |
1994 | else | 1992 | else |
@@ -2163,7 +2161,7 @@ static int t_show(struct seq_file *m, void *v) | |||
2163 | return 0; | 2161 | return 0; |
2164 | } | 2162 | } |
2165 | 2163 | ||
2166 | static struct seq_operations show_traces_seq_ops = { | 2164 | static const struct seq_operations show_traces_seq_ops = { |
2167 | .start = t_start, | 2165 | .start = t_start, |
2168 | .next = t_next, | 2166 | .next = t_next, |
2169 | .stop = t_stop, | 2167 | .stop = t_stop, |
@@ -2442,7 +2440,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2442 | return ret; | 2440 | return ret; |
2443 | } | 2441 | } |
2444 | 2442 | ||
2445 | filp->f_pos += cnt; | 2443 | *ppos += cnt; |
2446 | 2444 | ||
2447 | return cnt; | 2445 | return cnt; |
2448 | } | 2446 | } |
@@ -2584,7 +2582,7 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf, | |||
2584 | } | 2582 | } |
2585 | mutex_unlock(&trace_types_lock); | 2583 | mutex_unlock(&trace_types_lock); |
2586 | 2584 | ||
2587 | filp->f_pos += cnt; | 2585 | *ppos += cnt; |
2588 | 2586 | ||
2589 | return cnt; | 2587 | return cnt; |
2590 | } | 2588 | } |
@@ -2766,7 +2764,7 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, | |||
2766 | if (err) | 2764 | if (err) |
2767 | return err; | 2765 | return err; |
2768 | 2766 | ||
2769 | filp->f_pos += ret; | 2767 | *ppos += ret; |
2770 | 2768 | ||
2771 | return ret; | 2769 | return ret; |
2772 | } | 2770 | } |
@@ -3301,7 +3299,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
3301 | } | 3299 | } |
3302 | } | 3300 | } |
3303 | 3301 | ||
3304 | filp->f_pos += cnt; | 3302 | *ppos += cnt; |
3305 | 3303 | ||
3306 | /* If check pages failed, return ENOMEM */ | 3304 | /* If check pages failed, return ENOMEM */ |
3307 | if (tracing_disabled) | 3305 | if (tracing_disabled) |
@@ -4389,7 +4387,7 @@ __init static int tracer_alloc_buffers(void) | |||
4389 | if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL)) | 4387 | if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL)) |
4390 | goto out_free_buffer_mask; | 4388 | goto out_free_buffer_mask; |
4391 | 4389 | ||
4392 | if (!alloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL)) | 4390 | if (!zalloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL)) |
4393 | goto out_free_tracing_cpumask; | 4391 | goto out_free_tracing_cpumask; |
4394 | 4392 | ||
4395 | /* To save memory, keep the ring buffer size to its minimum */ | 4393 | /* To save memory, keep the ring buffer size to its minimum */ |
@@ -4400,7 +4398,6 @@ __init static int tracer_alloc_buffers(void) | |||
4400 | 4398 | ||
4401 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); | 4399 | cpumask_copy(tracing_buffer_mask, cpu_possible_mask); |
4402 | cpumask_copy(tracing_cpumask, cpu_all_mask); | 4400 | cpumask_copy(tracing_cpumask, cpu_all_mask); |
4403 | cpumask_clear(tracing_reader_cpumask); | ||
4404 | 4401 | ||
4405 | /* TODO: make the number of buffers hot pluggable with CPUS */ | 4402 | /* TODO: make the number of buffers hot pluggable with CPUS */ |
4406 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, | 4403 | global_trace.buffer = ring_buffer_alloc(ring_buf_size, |