Skip to content

Commit 6f05dca

Browse files
sunlimingrostedt
authored andcommitted
tracing/user_events: Fix the incorrect trace record for empty arguments events
The user_events support events that has empty arguments. But the trace event is discarded and not really committed when the arguments is empty. Fix this by not attempting to copy in zero-length data. Link: https://lkml.kernel.org/r/20230606062027.1008398-2-sunliming@kylinos.cn Acked-by: Beau Belgrave <beaub@linux.microsoft.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: sunliming <sunliming@kylinos.cn> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent e70bb54 commit 6f05dca

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/trace/trace_events_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i,
14321432
if (unlikely(!entry))
14331433
return;
14341434

1435-
if (unlikely(!copy_nofault(entry + 1, i->count, i)))
1435+
if (unlikely(i->count != 0 && !copy_nofault(entry + 1, i->count, i)))
14361436
goto discard;
14371437

14381438
if (!list_empty(&user->validators) &&
@@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i,
14731473

14741474
perf_fetch_caller_regs(regs);
14751475

1476-
if (unlikely(!copy_nofault(perf_entry + 1, i->count, i)))
1476+
if (unlikely(i->count != 0 && !copy_nofault(perf_entry + 1, i->count, i)))
14771477
goto discard;
14781478

14791479
if (!list_empty(&user->validators) &&

0 commit comments

Comments
 (0)