diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-12-15 01:05:46 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-15 01:05:46 -0500 |
commit | 797e7f599688564b7a6c65d748dc6f96d60118c6 (patch) | |
tree | 459d7435cb4613a5c1ace829d7ac6682abc3369a | |
parent | 868c803feabfec0acbb588e5052bae8caf6cbec1 (diff) |
Prevent an infinite loop in searching by timestamp
If the search for a record comes down to being on a page
where the timestamp is greater than the page but less then the
next page to look for, the code will go into an infinite loop.
This is because the next page to look for will be the same as
the starting page, and it will never continue to move forward.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-input.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/trace-input.c b/trace-input.c index 3747680..feddf83 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -885,6 +885,10 @@ tracecmd_set_cpu_to_timestamp(struct tracecmd_input *handle, int cpu, | |||
885 | 885 | ||
886 | next = start + (end - start) / 2; | 886 | next = start + (end - start) / 2; |
887 | next &= ~(handle->page_size - 1); | 887 | next &= ~(handle->page_size - 1); |
888 | |||
889 | /* Prevent an infinite loop if start and end are a page off */ | ||
890 | if (next == start) | ||
891 | start = next += handle->page_size; | ||
888 | } | 892 | } |
889 | 893 | ||
890 | /* | 894 | /* |