diff mbox series

libtraceevent: Return error on event parsing if format parsing fails

Message ID 20250109102338.6128644d@gandalf.local.home (mailing list archive)
State Accepted
Commit 2f7cfddd8068de199cbc24d8411bbc0c1f97ed2f
Headers show
Series libtraceevent: Return error on event parsing if format parsing fails | expand

Commit Message

Steven Rostedt Jan. 9, 2025, 3:23 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The event parsing should not fail if the "print fmt" portion fails, as
that is just a hint by the kernel on how to display the event. But that
portion can contain kernel internal information that is not available to
user space and there's no way the library can parse it properly. When that
fails, the event printing falls back to simply showing the content of all
the fields.

But if the fields themselves fail to parse, then there's no way to parse
the event properly. This should end up as a failure of parsing the event.

Link: https://lore.kernel.org/all/20250102174317.1594-1-shiju.jose@huawei.com/

Reported-by: Shiju Jose <shiju.jose@huawei.com>
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 33ed7fb47fff..f2e50b0e8992 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -7841,7 +7841,7 @@  static enum tep_errno parse_format(struct tep_event **eventp,
 	ret = event_read_format(event);
 	if (ret < 0) {
 		ret = TEP_ERRNO__READ_FORMAT_FAILED;
-		goto event_parse_failed;
+		goto event_alloc_failed;
 	}
 
 	/*