Skip to content

Commit 8f6e8a3

Browse files
Steven Rostedtrostedt
authored andcommitted
tracing: user local buffer variable for trace branch tracer
Just using the tr->buffer for the API to trace_buffer_lock_reserve is not good enough. This is because the tr->buffer may change, and we do not want to commit with a different buffer that we reserved from. This patch uses a local variable to hold the buffer that was used to reserve and commit with. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent c8647b2 commit 8f6e8a3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎kernel/trace/trace_branch.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
3434
struct trace_array *tr = branch_tracer;
3535
struct ring_buffer_event *event;
3636
struct trace_branch *entry;
37+
struct ring_buffer *buffer;
3738
unsigned long flags;
3839
int cpu, pc;
3940
const char *p;
@@ -54,7 +55,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
5455
goto out;
5556

5657
pc = preempt_count();
57-
event = trace_buffer_lock_reserve(tr->buffer, TRACE_BRANCH,
58+
buffer = tr->buffer;
59+
event = trace_buffer_lock_reserve(buffer, TRACE_BRANCH,
5860
sizeof(*entry), flags, pc);
5961
if (!event)
6062
goto out;
@@ -74,8 +76,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
7476
entry->line = f->line;
7577
entry->correct = val == expect;
7678

77-
if (!filter_check_discard(call, entry, tr->buffer, event))
78-
ring_buffer_unlock_commit(tr->buffer, event);
79+
if (!filter_check_discard(call, entry, buffer, event))
80+
ring_buffer_unlock_commit(buffer, event);
7981

8082
out:
8183
atomic_dec(&tr->data[cpu]->disabled);

0 commit comments

Comments
 (0)