Skip to contentSkip to conversation

trace-cmd split: Initialize current in parse_file()

PATCH New Steven Rostedt 1 participant 1 message Jan 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 trace-cmd split: Initialize current in parse_file()

From: "Steven Rostedt (Google)" <[email protected]>

The code fix to correctly split start/end/time-window parameters removed an initialization of "current" which can now fall out being uninitialized and used for a later compare.

Found with valgrind.

Fixes 1439b8f518 ("trace-cmd split: Correctly split with start/end/time-window parameters")

---
Changes since v1: https://lore.kernel.org/all/[email protected]/

- rebase on the fixed commit, not in the middle of the other split patches

 tracecmd/trace-split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tracecmd/trace-split.c +1 -1
index b6c056b5f34b..8c710da15f78 100644
@@ -358,7 +358,7 @@ static unsigned long long parse_file(struct tracecmd_input *handle,
 				     enum split_types type,
 				     bool *end_reached)
 {
-	unsigned long long current;
+	unsigned long long current = 0;
 	struct tracecmd_output *ohandle;
 	struct cpu_data *cpu_data;
 	struct tep_record *record;
Signature · 1 line
2.43.0