summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_selftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_selftest.c')
-rw-r--r--kernel/trace/trace_selftest.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 499d01c44cd1..00dd6485bdd7 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -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;
@@ -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();
OpenPOWER on IntegriCloud