diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-04-22 00:56:11 -0400 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-04-24 10:33:08 -0400 |
commit | c481f9301183260a78e55fa4d70d977b68c81846 (patch) | |
tree | 711a90b3c494a19dab524c8482b20eff2d4ee665 /tools | |
parent | 3186b6815d49b5e0defbd884223da3778edb59fc (diff) |
perf ui/tui: Fix off-by-one in hist_browser__update_nr_entries()
The nr_entries variable is increased inside the loop in the function
but it always count the first entry regardless of it's filtered or
not; caused an off-by-one error.
It'd become a problem especially there's no entry at all - it'd get a
segfault during referencing a NULL pointer.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1398327843-31845-9-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 4d416984c59d..311226edae12 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1348,10 +1348,10 @@ static void hist_browser__update_pcnt_entries(struct hist_browser *hb) | |||
1348 | u64 nr_entries = 0; | 1348 | u64 nr_entries = 0; |
1349 | struct rb_node *nd = rb_first(&hb->hists->entries); | 1349 | struct rb_node *nd = rb_first(&hb->hists->entries); |
1350 | 1350 | ||
1351 | while (nd) { | 1351 | while ((nd = hists__filter_entries(nd, hb->hists, |
1352 | hb->min_pcnt)) != NULL) { | ||
1352 | nr_entries++; | 1353 | nr_entries++; |
1353 | nd = hists__filter_entries(rb_next(nd), hb->hists, | 1354 | nd = rb_next(nd); |
1354 | hb->min_pcnt); | ||
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | hb->nr_pcnt_entries = nr_entries; | 1357 | hb->nr_pcnt_entries = nr_entries; |