Message ID | 20241112022815.191201-1-hao.ge@linux.dev (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | perf bpf-filter: Return -1 directly when pfi allocation fails | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Tue, Nov 12, 2024 at 10:28:15AM +0800, Hao Ge wrote: > From: Hao Ge <gehao@kylinos.cn> > > Directly return -1 when pfi allocation fails, The convention for this function is to return -errno, so please resubmit returning -ENOMEM. - Arnaldo > instead of performing other operations on pfi. > > Fixes: 0fe2b18ddc40 ("perf bpf-filter: Support multiple events properly") > Signed-off-by: Hao Ge <gehao@kylinos.cn> > --- > tools/perf/util/bpf-filter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c > index e87b6789eb9e..34c8bf7e469e 100644 > --- a/tools/perf/util/bpf-filter.c > +++ b/tools/perf/util/bpf-filter.c > @@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en > pfi = zalloc(sizeof(*pfi)); > if (pfi == NULL) { > pr_err("Cannot save pinned filter index\n"); > - goto err; > + return -1; > } > > pfi->evsel = evsel; > -- > 2.25.1
diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c index e87b6789eb9e..34c8bf7e469e 100644 --- a/tools/perf/util/bpf-filter.c +++ b/tools/perf/util/bpf-filter.c @@ -375,7 +375,7 @@ static int create_idx_hash(struct evsel *evsel, struct perf_bpf_filter_entry *en pfi = zalloc(sizeof(*pfi)); if (pfi == NULL) { pr_err("Cannot save pinned filter index\n"); - goto err; + return -1; } pfi->evsel = evsel;