aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-22 18:41:59 +0100
committerIngo Molnar <mingo@elte.hu>2009-03-22 18:43:25 +0100
commitfe9f57f250ab4d781b99504caeb218ca2db14c1a (patch)
treedc2452c3a9eb2f7cb220270e4ee0de132db6bb50 /kernel/trace/trace_events.c
parentcfb180f3e71b2a280a254c8646a9ab1beab63f84 (diff)
tracing: add run-time field descriptions for event filtering, kfree fix
Impact: fix potential kfree of random data in (rare) failure path Zero-initialize the field structure. Reported-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <1237710639.7703.46.camel@charm-linux> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 97d4daaddd9..594d78aaa18 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -24,26 +24,31 @@ int trace_define_field(struct ftrace_event_call *call, char *type,
{
struct ftrace_event_field *field;
- field = kmalloc(sizeof(*field), GFP_KERNEL);
+ field = kzalloc(sizeof(*field), GFP_KERNEL);
if (!field)
goto err;
+
field->name = kstrdup(name, GFP_KERNEL);
if (!field->name)
goto err;
+
field->type = kstrdup(type, GFP_KERNEL);
if (!field->type)
goto err;
+
field->offset = offset;
field->size = size;
list_add(&field->link, &call->fields);
return 0;
+
err:
if (field) {
kfree(field->name);
kfree(field->type);
}
kfree(field);
+
return -ENOMEM;
}