Message ID | 20240111171352.5bd23613@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | 5659b730535a19fc823dea2dd7f64d34fa7a08b8 |
Headers | show |
Series | libtracecmd: Return NULL if page is NULL in peek_last_event() | expand |
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index f458dcec68a8..a10d74cf6cf4 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -2973,6 +2973,10 @@ static struct tep_record *peek_last_event(struct tracecmd_input *handle, if (record) return record; + /* page can be NULL if the size is zero */ + if (!page) + return NULL; + page_offset = page->offset - handle->page_size; if (page_offset < handle->cpu_data[cpu].file_offset) return NULL;