perf hists browser: Avoid potential NULL dereference
authorIan Rogers <irogers@google.com>
Mon, 9 Oct 2023 18:39:13 +0000 (11:39 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 12 Oct 2023 17:01:56 +0000 (10:01 -0700)
On other code paths browser->he_selection is NULL checked, add a
missing case reported by clang-tidy.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: llvm@lists.linux.dev
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20231009183920.200859-13-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/ui/browsers/hists.c

index f02ee60..f4812b2 100644 (file)
@@ -3302,7 +3302,7 @@ do_hotkey:                 // key came straight from options ui__popup_menu()
                                                        &options[nr_options],
                                                        &bi->to.ms,
                                                        bi->to.al_addr);
-               } else {
+               } else if (browser->he_selection) {
                        nr_options += add_annotate_opt(browser,
                                                       &actions[nr_options],
                                                       &options[nr_options],