Skip to content

Commit 0441c44

Browse files
rostedtgregkh
authored andcommitted
tracing: Fix trace_event_raw_event_synth() if else statement
commit 9971c3f upstream. The test to check if the field is a stack is to be done if it is not a string. But the code had: } if (event->fields[i]->is_stack) { and not } else if (event->fields[i]->is_stack) { which would cause it to always be tested. Worse yet, this also included an "else" statement that was only to be called if the field was not a string and a stack, but this code allows it to be called if it was a string (and not a stack). Also fixed some whitespace issues. Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Tom Zanussi <[email protected]> Fixes: 00cf3d6 ("tracing: Allow synthetic events to pass around stacktraces") Reported-by: kernel test robot <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f5e8f7a commit 0441c44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace_events_synth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ static notrace void trace_event_raw_event_synth(void *__data,
576576
event->fields[i]->is_dynamic,
577577
data_size, &n_u64);
578578
data_size += len; /* only dynamic string increments */
579-
} if (event->fields[i]->is_stack) {
580-
long *stack = (long *)(long)var_ref_vals[val_idx];
579+
} else if (event->fields[i]->is_stack) {
580+
long *stack = (long *)(long)var_ref_vals[val_idx];
581581

582582
len = trace_stack(entry, event, stack,
583583
data_size, &n_u64);

0 commit comments

Comments
 (0)