Skip to contentSkip to conversation

perf: Fix static strings treated like dynamic ones

PATCH New Frederic Weisbecker 1 participant 1 message May 5, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Fix static strings treated like dynamic ones

The raw_field_ptr() helper, used to retrieve the address of a field inside a trace event, treats every strings as if they were dynamic
ie: having a secondary level of indirection to retrieve their contents.

FIELD_IS_STRING doesn't mean FIELD_IS_DYNAMIC, we only need to compute the secondary dereference for the latter case.

This fixes perf sched segfaults, bad cmdline report and may be some other bugs.

---
 tools/perf/util/trace-event-parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/trace-event-parse.c +1 -1
index 069f261..73a0222 100644
@@ -1937,7 +1937,7 @@ void *raw_field_ptr(struct event *event, const char *name, void *data)
 	if (!field)
 		return NULL;
 
-	if (field->flags & FIELD_IS_STRING) {
+	if (field->flags & FIELD_IS_DYNAMIC) {
 		int offset;
 
 		offset = *(int *)(data + field->offset);
Signature · 1 line
1.6.2.3