Skip to content

Commit

Permalink
tracing: Initialize ret in syscall_enter_define_fields()
Browse files Browse the repository at this point in the history
If syscall_enter_define_fields() is called on a system call with no
arguments, the return code variable "ret" will never get initialized.
Initialize it to zero.

Fixes: 04ae87a ("ftrace: Rework event_create_dir()")
Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/0FA8C6E3-D9F5-416D-A1B0-5E4CD583A101@lca.pw
  • Loading branch information
Steven Rostedt (VMware) authored and Peter Zijlstra committed Jan 17, 2020
1 parent e4add24 commit 31537cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/trace/trace_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ static int __init syscall_enter_define_fields(struct trace_event_call *call)
struct syscall_trace_enter trace;
struct syscall_metadata *meta = call->data;
int offset = offsetof(typeof(trace), args);
int ret, i;
int ret = 0;
int i;

for (i = 0; i < meta->nb_args; i++) {
ret = trace_define_field(call, meta->types[i],
Expand Down

0 comments on commit 31537cf

Please sign in to comment.