Message ID | 20220404111812.2b3753df@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | ffee97c4750e38abdde0529cd37b1aca3681c14b |
Headers | show |
Series | trace-cmd library: Do not read if cpu is greater than cpus | expand |
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index b8705ce364d1..425c6077d88e 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -2462,6 +2462,9 @@ tracecmd_read_data(struct tracecmd_input *handle, int cpu) { struct tep_record *record; + if (cpu >= handle->cpus) + return NULL; + record = tracecmd_peek_data(handle, cpu); handle->cpu_data[cpu].next = NULL; if (record) {