[PATCH] libtraceevent: Calculate dynamic size for dynamic fields as well as arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 3a1c06828b67a31de01491a400fdc20674a0f95f Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
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@xxxxxxxxxxx>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
-- 
2.35.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux