On Wed, Jul 03, 2024 at 03:30:28PM -0700, Namhyung Kim wrote: > And the value is now an array. This is to support multiple filter > entries in the map later. > No functional changes intended. > +++ b/tools/perf/util/bpf-filter.c > @@ -93,71 +93,102 @@ static int check_sample_flags(struct evsel *evsel, struct perf_bpf_filter_expr * > > int perf_bpf_filter__prepare(struct evsel *evsel) > { > - int i, x, y, fd; > + int i, x, y, fd, ret; > struct sample_filter_bpf *skel; > struct bpf_program *prog; > struct bpf_link *link; > struct perf_bpf_filter_expr *expr; > + struct perf_bpf_filter_entry *entry; > + > + entry = calloc(MAX_FILTERS, sizeof(*entry)); > + if (entry == NULL) > + return -1; I'm changing this to -ENOMEM since you use errno values in the other failure cases, ok? This: diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c index 2510832d83f95e03..e98bacf41a248ced 100644 --- a/tools/perf/util/bpf-filter.c +++ b/tools/perf/util/bpf-filter.c @@ -102,7 +102,7 @@ int perf_bpf_filter__prepare(struct evsel *evsel) entry = calloc(MAX_FILTERS, sizeof(*entry)); if (entry == NULL) - return -1; + return -ENOMEM; skel = sample_filter_bpf__open_and_load(); if (!skel) {