aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c17
-rw-r--r--kernel/trace/trace.c6
-rw-r--r--kernel/trace/trace_events_filter.c7
-rw-r--r--kernel/trace/trace_syscalls.c4
4 files changed, 18 insertions, 16 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 683d559a0eef..d1499e910fe8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1129,7 +1129,7 @@ static struct ftrace_hash *alloc_ftrace_hash(int size_bits)
1129 return NULL; 1129 return NULL;
1130 1130
1131 size = 1 << size_bits; 1131 size = 1 << size_bits;
1132 hash->buckets = kzalloc(sizeof(*hash->buckets) * size, GFP_KERNEL); 1132 hash->buckets = kcalloc(size, sizeof(*hash->buckets), GFP_KERNEL);
1133 1133
1134 if (!hash->buckets) { 1134 if (!hash->buckets) {
1135 kfree(hash); 1135 kfree(hash);
@@ -3146,8 +3146,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
3146 mutex_lock(&ftrace_regex_lock); 3146 mutex_lock(&ftrace_regex_lock);
3147 if (reset) 3147 if (reset)
3148 ftrace_filter_reset(hash); 3148 ftrace_filter_reset(hash);
3149 if (buf) 3149 if (buf && !ftrace_match_records(hash, buf, len)) {
3150 ftrace_match_records(hash, buf, len); 3150 ret = -EINVAL;
3151 goto out_regex_unlock;
3152 }
3151 3153
3152 mutex_lock(&ftrace_lock); 3154 mutex_lock(&ftrace_lock);
3153 ret = ftrace_hash_move(ops, enable, orig_hash, hash); 3155 ret = ftrace_hash_move(ops, enable, orig_hash, hash);
@@ -3157,6 +3159,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
3157 3159
3158 mutex_unlock(&ftrace_lock); 3160 mutex_unlock(&ftrace_lock);
3159 3161
3162 out_regex_unlock:
3160 mutex_unlock(&ftrace_regex_lock); 3163 mutex_unlock(&ftrace_regex_lock);
3161 3164
3162 free_ftrace_hash(hash); 3165 free_ftrace_hash(hash);
@@ -3173,10 +3176,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
3173 * Filters denote which functions should be enabled when tracing is enabled. 3176 * Filters denote which functions should be enabled when tracing is enabled.
3174 * If @buf is NULL and reset is set, all functions will be enabled for tracing. 3177 * If @buf is NULL and reset is set, all functions will be enabled for tracing.
3175 */ 3178 */
3176void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 3179int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
3177 int len, int reset) 3180 int len, int reset)
3178{ 3181{
3179 ftrace_set_regex(ops, buf, len, reset, 1); 3182 return ftrace_set_regex(ops, buf, len, reset, 1);
3180} 3183}
3181EXPORT_SYMBOL_GPL(ftrace_set_filter); 3184EXPORT_SYMBOL_GPL(ftrace_set_filter);
3182 3185
@@ -3191,10 +3194,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter);
3191 * is enabled. If @buf is NULL and reset is set, all functions will be enabled 3194 * is enabled. If @buf is NULL and reset is set, all functions will be enabled
3192 * for tracing. 3195 * for tracing.
3193 */ 3196 */
3194void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 3197int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
3195 int len, int reset) 3198 int len, int reset)
3196{ 3199{
3197 ftrace_set_regex(ops, buf, len, reset, 0); 3200 return ftrace_set_regex(ops, buf, len, reset, 0);
3198} 3201}
3199EXPORT_SYMBOL_GPL(ftrace_set_notrace); 3202EXPORT_SYMBOL_GPL(ftrace_set_notrace);
3200/** 3203/**
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a3f1bc5d2a00..10d5503f0d04 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2764,12 +2764,12 @@ static const char readme_msg[] =
2764 "tracing mini-HOWTO:\n\n" 2764 "tracing mini-HOWTO:\n\n"
2765 "# mount -t debugfs nodev /sys/kernel/debug\n\n" 2765 "# mount -t debugfs nodev /sys/kernel/debug\n\n"
2766 "# cat /sys/kernel/debug/tracing/available_tracers\n" 2766 "# cat /sys/kernel/debug/tracing/available_tracers\n"
2767 "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" 2767 "wakeup wakeup_rt preemptirqsoff preemptoff irqsoff function nop\n\n"
2768 "# cat /sys/kernel/debug/tracing/current_tracer\n" 2768 "# cat /sys/kernel/debug/tracing/current_tracer\n"
2769 "nop\n" 2769 "nop\n"
2770 "# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" 2770 "# echo wakeup > /sys/kernel/debug/tracing/current_tracer\n"
2771 "# cat /sys/kernel/debug/tracing/current_tracer\n" 2771 "# cat /sys/kernel/debug/tracing/current_tracer\n"
2772 "sched_switch\n" 2772 "wakeup\n"
2773 "# cat /sys/kernel/debug/tracing/trace_options\n" 2773 "# cat /sys/kernel/debug/tracing/trace_options\n"
2774 "noprint-parent nosym-offset nosym-addr noverbose\n" 2774 "noprint-parent nosym-offset nosym-addr noverbose\n"
2775 "# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" 2775 "# echo print-parent > /sys/kernel/debug/tracing/trace_options\n"
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 24aee7127451..76afaee99dbc 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -685,7 +685,7 @@ find_event_field(struct ftrace_event_call *call, char *name)
685 685
686static int __alloc_pred_stack(struct pred_stack *stack, int n_preds) 686static int __alloc_pred_stack(struct pred_stack *stack, int n_preds)
687{ 687{
688 stack->preds = kzalloc(sizeof(*stack->preds)*(n_preds + 1), GFP_KERNEL); 688 stack->preds = kcalloc(n_preds + 1, sizeof(*stack->preds), GFP_KERNEL);
689 if (!stack->preds) 689 if (!stack->preds)
690 return -ENOMEM; 690 return -ENOMEM;
691 stack->index = n_preds; 691 stack->index = n_preds;
@@ -826,8 +826,7 @@ static int __alloc_preds(struct event_filter *filter, int n_preds)
826 if (filter->preds) 826 if (filter->preds)
827 __free_preds(filter); 827 __free_preds(filter);
828 828
829 filter->preds = 829 filter->preds = kcalloc(n_preds, sizeof(*filter->preds), GFP_KERNEL);
830 kzalloc(sizeof(*filter->preds) * n_preds, GFP_KERNEL);
831 830
832 if (!filter->preds) 831 if (!filter->preds)
833 return -ENOMEM; 832 return -ENOMEM;
@@ -1486,7 +1485,7 @@ static int fold_pred(struct filter_pred *preds, struct filter_pred *root)
1486 children = count_leafs(preds, &preds[root->left]); 1485 children = count_leafs(preds, &preds[root->left]);
1487 children += count_leafs(preds, &preds[root->right]); 1486 children += count_leafs(preds, &preds[root->right]);
1488 1487
1489 root->ops = kzalloc(sizeof(*root->ops) * children, GFP_KERNEL); 1488 root->ops = kcalloc(children, sizeof(*root->ops), GFP_KERNEL);
1490 if (!root->ops) 1489 if (!root->ops)
1491 return -ENOMEM; 1490 return -ENOMEM;
1492 1491
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index cb654542c1a1..43500153dd1e 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -468,8 +468,8 @@ int __init init_ftrace_syscalls(void)
468 unsigned long addr; 468 unsigned long addr;
469 int i; 469 int i;
470 470
471 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * 471 syscalls_metadata = kcalloc(NR_syscalls, sizeof(*syscalls_metadata),
472 NR_syscalls, GFP_KERNEL); 472 GFP_KERNEL);
473 if (!syscalls_metadata) { 473 if (!syscalls_metadata) {
474 WARN_ON(1); 474 WARN_ON(1);
475 return -ENOMEM; 475 return -ENOMEM;