diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-08-18 22:03:49 -0400 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-09-08 18:20:18 -0400 |
commit | 04651d0ebe9d4719e8774c411796d51a83d44680 (patch) | |
tree | 6768d02471dbc952acab3326390a741fa42bb6cc | |
parent | 9de59a020c64f4536f3a4d0dcfbcad4bbcc0f712 (diff) | |
download | libtracefs-04651d0ebe9d4719e8774c411796d51a83d44680.tar.gz |
libtracefs sqlhist: Allow pointers to match longs
Currently, if a field that is a long tries to match a field that is a
pointer, tracefs_sqlhist() will fail with incompatible fields. But the
kernel will still allow it to match, do not fail here.
Link: https://lore.kernel.org/linux-trace-devel/20220819020349.747429-4-rostedt@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | src/tracefs-hist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tracefs-hist.c b/src/tracefs-hist.c index 302b9a7..14988d8 100644 --- a/src/tracefs-hist.c +++ b/src/tracefs-hist.c @@ -796,6 +796,7 @@ static bool verify_event_fields(struct tep_event *start_event, { const struct tep_format_field *start_field; const struct tep_format_field *end_field; + int start_flags, end_flags; if (!trace_verify_event_field(start_event, start_field_name, &start_field)) @@ -806,7 +807,11 @@ static bool verify_event_fields(struct tep_event *start_event, &end_field)) return false; - if (start_field->flags != end_field->flags || + /* A pointer can still match a long */ + start_flags = start_field->flags & ~TEP_FIELD_IS_POINTER; + end_flags = end_field->flags & ~TEP_FIELD_IS_POINTER; + + if (start_flags != end_flags || start_field->size != end_field->size) { errno = EBADE; return false; |