* [PATCH] tracing/histograms: String compares should not care about signed values
@ 2021-11-30 17:37 Steven Rostedt
2021-12-01 2:21 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2021-11-30 17:37 UTC (permalink / raw)
To: LKML
Cc: Ingo Molnar, Andrew Morton, Tom Zanussi, Masami Hiramatsu,
Yafang Shao, Sven Schnelle
From 95f7262b44dc54fed8007cc3db8b39cbd16999c6 Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Tue, 30 Nov 2021 12:31:23 -0500
Subject: [PATCH] tracing/histograms: String compares should not care about
signed values
When comparing two strings for the "onmatch" histogram trigger, fields
that are strings use string comparisons, which do not care about being
signed or not.
Do not fail to match two string fields if one is unsigned char array and
the other is a signed char array.
Link: https://lore.kernel.org/all/20211129123043.5cfd687a@gandalf.local.home/
Cc: stable@vgerk.kernel.org
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Yafang Shao <laoar.shao@gmail.com>
Fixes: b05e89ae7cf3b ("tracing: Accept different type for synthetic event fields")
Reported-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 9555b8e1d1e3..319f9c8ca7e7 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3757,7 +3757,7 @@ static int check_synth_field(struct synth_event *event,
if (strcmp(field->type, hist_field->type) != 0) {
if (field->size != hist_field->size ||
- field->is_signed != hist_field->is_signed)
+ (!field->is_string && field->is_signed != hist_field->is_signed))
return -EINVAL;
}
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tracing/histograms: String compares should not care about signed values
2021-11-30 17:37 [PATCH] tracing/histograms: String compares should not care about signed values Steven Rostedt
@ 2021-12-01 2:21 ` Masami Hiramatsu
2021-12-01 15:20 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2021-12-01 2:21 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Ingo Molnar, Andrew Morton, Tom Zanussi, Masami Hiramatsu,
Yafang Shao, Sven Schnelle
On Tue, 30 Nov 2021 12:37:36 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From 95f7262b44dc54fed8007cc3db8b39cbd16999c6 Mon Sep 17 00:00:00 2001
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> Date: Tue, 30 Nov 2021 12:31:23 -0500
> Subject: [PATCH] tracing/histograms: String compares should not care about
> signed values
>
> When comparing two strings for the "onmatch" histogram trigger, fields
> that are strings use string comparisons, which do not care about being
> signed or not.
>
> Do not fail to match two string fields if one is unsigned char array and
> the other is a signed char array.
>
> Link: https://lore.kernel.org/all/20211129123043.5cfd687a@gandalf.local.home/
Looks good to me.
Review-by: Masami Hiramatsu <mhiramatsu@kernel.org>
Thank you,
>
> Cc: stable@vgerk.kernel.org
> Cc: Tom Zanussi <zanussi@kernel.org>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Yafang Shao <laoar.shao@gmail.com>
> Fixes: b05e89ae7cf3b ("tracing: Accept different type for synthetic event fields")
> Reported-by: Sven Schnelle <svens@linux.ibm.com>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> kernel/trace/trace_events_hist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 9555b8e1d1e3..319f9c8ca7e7 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -3757,7 +3757,7 @@ static int check_synth_field(struct synth_event *event,
>
> if (strcmp(field->type, hist_field->type) != 0) {
> if (field->size != hist_field->size ||
> - field->is_signed != hist_field->is_signed)
> + (!field->is_string && field->is_signed != hist_field->is_signed))
> return -EINVAL;
> }
>
> --
> 2.31.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tracing/histograms: String compares should not care about signed values
2021-12-01 2:21 ` Masami Hiramatsu
@ 2021-12-01 15:20 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-12-01 15:20 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: LKML, Ingo Molnar, Andrew Morton, Tom Zanussi, Yafang Shao,
Sven Schnelle
On Wed, 1 Dec 2021 11:21:00 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> On Tue, 30 Nov 2021 12:37:36 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From 95f7262b44dc54fed8007cc3db8b39cbd16999c6 Mon Sep 17 00:00:00 2001
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > Date: Tue, 30 Nov 2021 12:31:23 -0500
> > Subject: [PATCH] tracing/histograms: String compares should not care about
> > signed values
> >
> > When comparing two strings for the "onmatch" histogram trigger, fields
> > that are strings use string comparisons, which do not care about being
> > signed or not.
> >
> > Do not fail to match two string fields if one is unsigned char array and
> > the other is a signed char array.
> >
> > Link: https://lore.kernel.org/all/20211129123043.5cfd687a@gandalf.local.home/
>
> Looks good to me.
>
> Review-by: Masami Hiramatsu <mhiramatsu@kernel.org>
>
>
Thanks Masami. I'll add your reviewed-by before posting to Linus.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-01 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 17:37 [PATCH] tracing/histograms: String compares should not care about signed values Steven Rostedt
2021-12-01 2:21 ` Masami Hiramatsu
2021-12-01 15:20 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®