trace-cmd: Read at least 8 bytes trace-id option
When reading the trace-id option from trace.dat file, check if the size
is at least 8 bytes. If the size is greater, use the first 8 bytes only
and ignore the rest. That way we can safely extend this option in the
future, without breaking the legacy logic.
Link: https://lore.kernel.org/linux-trace-devel/20210325064055.539554-24-tz.stoyanov@gmail.com
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 2093a3d..51b9603 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -2666,7 +2666,7 @@
trace_pid_map_load(handle, buf);
break;
case TRACECMD_OPTION_TRACEID:
- if (size != 8)
+ if (size < 8)
break;
handle->trace_id = tep_read_number(handle->pevent,
buf, 8);