public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/user_events: Handle matching arguments that is null from dyn_events
@ 2023-05-29  6:51 sunliming
  2023-05-29  8:21 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: sunliming @ 2023-05-29  6:51 UTC (permalink / raw)
  To: rostedt, mhiramat, beaub
  Cc: linux-kernel, linux-trace-kernel, linux-kselftest, sunliming

When A registering user event from dyn_events has no argments, it will pass the
matching check, regardless of whether there is a user event with the same name
and arguments. Add the matching check when the arguments of registering user
event is null.

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 kernel/trace/trace_events_user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index e90161294698..0d91dac206ff 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1712,6 +1712,8 @@ static bool user_event_match(const char *system, const char *event,
 
 	if (match && argc > 0)
 		match = user_fields_match(user, argc, argv);
+	else if (match && argc == 0)
+		match = list_empty(&user->fields);
 
 	return match;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tracing/user_events: Handle matching arguments that is null from dyn_events
  2023-05-29  6:51 [PATCH] tracing/user_events: Handle matching arguments that is null from dyn_events sunliming
@ 2023-05-29  8:21 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2023-05-29  8:21 UTC (permalink / raw)
  To: sunliming
  Cc: rostedt, beaub, linux-kernel, linux-trace-kernel, linux-kselftest

On Mon, 29 May 2023 14:51:10 +0800
sunliming <sunliming@kylinos.cn> wrote:

> When A registering user event from dyn_events has no argments, it will pass the
> matching check, regardless of whether there is a user event with the same name
> and arguments. Add the matching check when the arguments of registering user
> event is null.

OK, since the user_events doesn't support multi-definitions on the same name
event, this should be checked.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you!

> 
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
>  kernel/trace/trace_events_user.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index e90161294698..0d91dac206ff 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -1712,6 +1712,8 @@ static bool user_event_match(const char *system, const char *event,
>  
>  	if (match && argc > 0)
>  		match = user_fields_match(user, argc, argv);
> +	else if (match && argc == 0)
> +		match = list_empty(&user->fields);
>  
>  	return match;
>  }
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-29  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29  6:51 [PATCH] tracing/user_events: Handle matching arguments that is null from dyn_events sunliming
2023-05-29  8:21 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox