Skip to content

Commit 81d0fa4

Browse files
pietroborrellomhiramat
authored andcommitted
tracing/probe: trace_probe_primary_from_call(): checked list_first_entry
All callers of trace_probe_primary_from_call() check the return value to be non NULL. However, the function returns list_first_entry(&tpe->probes, ...) which can never be NULL. Additionally, it does not check for the list being possibly empty, possibly causing a type confusion on empty lists. Use list_first_entry_or_null() which solves both problems. Link: https://lore.kernel.org/linux-trace-kernel/20230128-list-entry-null-check-v1-1-8bde6a3da2ef@diag.uniroma1.it/ Fixes: 60d53e2 ("tracing/probe: Split trace_event related data from trace_probe") Signed-off-by: Pietro Borrello <[email protected]> Reviewed-by: Steven Rostedt (Google) <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Acked-by: Mukesh Ojha <[email protected]> Cc: [email protected] Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 7877cb9 commit 81d0fa4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace_probe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ trace_probe_primary_from_call(struct trace_event_call *call)
308308
{
309309
struct trace_probe_event *tpe = trace_probe_event_from_call(call);
310310

311-
return list_first_entry(&tpe->probes, struct trace_probe, list);
311+
return list_first_entry_or_null(&tpe->probes, struct trace_probe, list);
312312
}
313313

314314
static inline struct list_head *trace_probe_probe_list(struct trace_probe *tp)

0 commit comments

Comments
 (0)