Commit 6f05dcab authored by sunliming's avatar sunliming Committed by Steven Rostedt (Google)

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.cnAcked-by: default avatarBeau Belgrave <beaub@linux.microsoft.com>
Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: default avatarsunliming <sunliming@kylinos.cn>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent e70bb54d
...@@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i, ...@@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i,
if (unlikely(!entry)) if (unlikely(!entry))
return; return;
if (unlikely(!copy_nofault(entry + 1, i->count, i))) if (unlikely(i->count != 0 && !copy_nofault(entry + 1, i->count, i)))
goto discard; goto discard;
if (!list_empty(&user->validators) && if (!list_empty(&user->validators) &&
...@@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i, ...@@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i,
perf_fetch_caller_regs(regs); perf_fetch_caller_regs(regs);
if (unlikely(!copy_nofault(perf_entry + 1, i->count, i))) if (unlikely(i->count != 0 && !copy_nofault(perf_entry + 1, i->count, i)))
goto discard; goto discard;
if (!list_empty(&user->validators) && if (!list_empty(&user->validators) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment