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/[email protected] Acked-by: Beau Belgrave <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: sunliming <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent e70bb54 commit 6f05dca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)