Skip to contentSkip to conversation

tracing: Initialize ret in syscall_enter_define_fields()

PATCH In review Steven Rostedt 2 participants 2 messages Jan 8, 2020 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

PATCH 1/1 tracing: Initialize ret in syscall_enter_define_fields()

From: "Steven Rostedt (VMware)" <[email protected]>

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 04ae87a52074e ("ftrace: Rework event_create_dir()")
---
 kernel/trace/trace_syscalls.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_syscalls.c +2 -1
index 73140d80dd46..2978c29d87d4 100644
@@ -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],
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

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 04ae87a52074e ("ftrace: Rework event_create_dir()")

Thanks Steve!