Skip to content

Commit

Permalink
x86, hw-branch-tracer: allocate selftest iterator on heap
Browse files Browse the repository at this point in the history
Allocate the trace_iterator for the hw-branch-tracer selftest on the heap.

Signed-off-by: Markus Metzger <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
markus-metzger authored and Ingo Molnar committed Apr 7, 2009
1 parent de79f54 commit 4d657e5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions kernel/trace/trace_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ int
trace_selftest_startup_hw_branches(struct tracer *trace,
struct trace_array *tr)
{
struct trace_iterator iter;
struct trace_iterator *iter;
struct tracer tracer;
unsigned long count;
int ret;
Expand All @@ -777,17 +777,21 @@ trace_selftest_startup_hw_branches(struct tracer *trace,
* The hw-branch tracer needs to collect the trace from the various
* cpu trace buffers - before tracing is stopped.
*/
memset(&iter, 0, sizeof(iter));
iter = kzalloc(sizeof(*iter), GFP_KERNEL);
if (!iter)
return -ENOMEM;

memcpy(&tracer, trace, sizeof(tracer));

iter.trace = &tracer;
iter.tr = tr;
iter.pos = -1;
mutex_init(&iter.mutex);
iter->trace = &tracer;
iter->tr = tr;
iter->pos = -1;
mutex_init(&iter->mutex);

trace->open(&iter);
trace->open(iter);

mutex_destroy(&iter.mutex);
mutex_destroy(&iter->mutex);
kfree(iter);

tracing_stop();

Expand Down

0 comments on commit 4d657e5

Please sign in to comment.