[PATCH] trace-view: Handle unknown events more gracefully

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

 



Kernel 2.6.35.7 generates invalid trace files due to
/sys/kernel/debug/tracing/events/scsi/scsi_dispatch_cmd_timeout/format
returning "FORMAT TOO BIG" (seems to be fixed in 2.6.36). This makes
pevent_data_event_from_type return NULL, and dereferencing of event
crashes the viewer.

Catch and report the error properly.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxx>
---
 trace-view-store.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/trace-view-store.c b/trace-view-store.c
index 0834df7..34f8155 100644
--- a/trace-view-store.c
+++ b/trace-view-store.c
@@ -507,12 +507,17 @@ trace_view_store_get_value (GtkTreeModel *tree_model,
 		case TRACE_VIEW_STORE_COL_INFO:
 			val = pevent_data_type(pevent, data);
 			event = pevent_data_event_from_type(pevent, val);
+			if (!event) {
+				if (column == TRACE_VIEW_STORE_COL_EVENT)
+					g_value_set_string(value, "[UNKNOWN EVENT]");
+				break;
+			}
+
 			if (column == TRACE_VIEW_STORE_COL_EVENT) {
 				g_value_set_string(value, event->name);
 				break;
 			}
 
-			
 			trace_seq_init(&s);
 			pevent_event_info(&s, event, data);
 			g_value_set_string(value, s.buffer);
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux