From 1c84b47f99ea7ab7a76a785edd29e14977e1ecd0 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 30 Jan 2024 10:55:52 -0800 Subject: [PATCH] perf report: Prevent segfault with --no-parent Prevent a perf report segfault with the (non sensical) --no-parent option Signed-off-By: Andi Kleen Acked-by: Namhyung Signed-off-by: Namhyung Kim Link: https://lore.kernel.org/r/20240130185552.150578-1-ak@linux.intel.com --- tools/perf/util/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 30254eb63709..92a1bd695e8a 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -3372,7 +3372,7 @@ int sort_dimension__add(struct perf_hpp_list *list, const char *tok, sort_dimension_add_dynamic_header(sd); } - if (sd->entry == &sort_parent) { + if (sd->entry == &sort_parent && parent_pattern) { int ret = regcomp(&parent_regex, parent_pattern, REG_EXTENDED); if (ret) { char err[BUFSIZ];