[for-linus][PATCH 1/2] tracing/histograms: String compares should not care about signed values

From: Steven Rostedt
Date: Wed Dec 01 2021 - 10:11:42 EST


From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxx/

Cc: stable@xxxxxxxxxxxxxxxx
Cc: Tom Zanussi <zanussi@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Yafang Shao <laoar.shao@xxxxxxxxx>
Fixes: b05e89ae7cf3b ("tracing: Accept different type for synthetic event fields")
Reported-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
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.33.0