diff mbox series

libtraceevent: Calculate dynamic size for dynamic fields as well as arrays

Message ID 20221213221651.0d36897a@gandalf.local.home (mailing list archive)
State Accepted
Commit 4fb990a5a922d13dff847939a565a0adfa4e1b37
Headers show
Series libtraceevent: Calculate dynamic size for dynamic fields as well as arrays | expand

Commit Message

Steven Rostedt Dec. 14, 2022, 3:16 a.m. UTC
From 3a1c06828b67a31de01491a400fdc20674a0f95f Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Date: Tue, 13 Dec 2022 22:14:22 -0500
Subject: [PATCH] libtraceevent: Calculate dynamic size for dynamic fields as
 well as arrays

With the new "cpumask_t" field, which is dynamic and is denoted with
"__data_loc", it needs to be processed as dynamic in size, and not as
static.

When calculating the field size, check for both the field being an array
as well as being dynamic, as it can be dynamic without being an array.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/event-parse.c b/src/event-parse.c
index d1363a5826d5..8ec95a2ac069 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -1927,7 +1927,7 @@  static int event_read_fields(struct tep_event *event, struct tep_format_field **
 
 		free_token(token);
 
-		if (field->flags & TEP_FIELD_IS_ARRAY) {
+		if (field->flags & (TEP_FIELD_IS_ARRAY | TEP_FIELD_IS_DYNAMIC)) {
 			if (field->arraylen)
 				field->elementsize = field->size / field->arraylen;
 			else if (field->flags & TEP_FIELD_IS_DYNAMIC)