mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
perf report TUI: Fix segmentation fault in perf_evsel__hists_browse()
[ Upstream commit d61cbb859b45fdb6b4997f2d51834fae41af0e94 ]
The segmentation fault can be reproduced as following steps:
1) Executing perf report in tui.
2) Typing '/xxxxx' to filter the symbol to get nothing matched.
3) Pressing enter with no entry selected.
Then it will report a segmentation fault.
It is caused by the lack of check of browser->he_selection when
accessing it's member res_samples in perf_evsel__hists_browse().
These processes are meaningful for specified samples, so we can skip
these when nothing is selected.
Fixes: 4968ac8fb7 ("perf report: Implement browsing of individual samples")
Signed-off-by: Wei Li <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Hanjun Guo <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: Mark Rutland <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
2d15663304
commit
9ca67a4532
1 changed files with 11 additions and 6 deletions
|
|
@ -2224,6 +2224,11 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser
|
|||
return browser->he_selection->thread;
|
||||
}
|
||||
|
||||
static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser)
|
||||
{
|
||||
return browser->he_selection ? browser->he_selection->res_samples : NULL;
|
||||
}
|
||||
|
||||
/* Check whether the browser is for 'top' or 'report' */
|
||||
static inline bool is_report_browser(void *timer)
|
||||
{
|
||||
|
|
@ -3170,16 +3175,16 @@ skip_annotation:
|
|||
&options[nr_options], NULL, NULL, evsel);
|
||||
nr_options += add_res_sample_opt(browser, &actions[nr_options],
|
||||
&options[nr_options],
|
||||
hist_browser__selected_entry(browser)->res_samples,
|
||||
evsel, A_NORMAL);
|
||||
hist_browser__selected_res_sample(browser),
|
||||
evsel, A_NORMAL);
|
||||
nr_options += add_res_sample_opt(browser, &actions[nr_options],
|
||||
&options[nr_options],
|
||||
hist_browser__selected_entry(browser)->res_samples,
|
||||
evsel, A_ASM);
|
||||
hist_browser__selected_res_sample(browser),
|
||||
evsel, A_ASM);
|
||||
nr_options += add_res_sample_opt(browser, &actions[nr_options],
|
||||
&options[nr_options],
|
||||
hist_browser__selected_entry(browser)->res_samples,
|
||||
evsel, A_SOURCE);
|
||||
hist_browser__selected_res_sample(browser),
|
||||
evsel, A_SOURCE);
|
||||
nr_options += add_switch_opt(browser, &actions[nr_options],
|
||||
&options[nr_options]);
|
||||
skip_scripting:
|
||||
|
|
|
|||
Loading…
Reference in a new issue