perf report: Additional config warnings
authorIan Rogers <irogers@google.com>
Tue, 28 Mar 2023 23:55:39 +0000 (16:55 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 4 Apr 2023 12:39:56 +0000 (09:39 -0300)
If the default_sort_order isn't correctly strdup-ed warn and return an
error. Debug warn if no option is matched.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: German Gomez <german.gomez@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Tom Rix <trix@redhat.com>
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230328235543.1082207-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c

index 6400615..500f9d8 100644 (file)
@@ -143,6 +143,10 @@ static int report__config(const char *var, const char *value, void *cb)
 
        if (!strcmp(var, "report.sort_order")) {
                default_sort_order = strdup(value);
+               if (!default_sort_order) {
+                       pr_err("Not enough memory for report.sort_order\n");
+                       return -1;
+               }
                return 0;
        }
 
@@ -151,6 +155,7 @@ static int report__config(const char *var, const char *value, void *cb)
                return 0;
        }
 
+       pr_debug("%s variable unknown, ignoring...", var);
        return 0;
 }