From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: [PATCH v3 1/5] bpf: add allocation annotations to functions
Date: Sat, 1 Nov 2025 11:04:43 -0700 [thread overview]
Message-ID: <20251101180659.43883-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20251101180659.43883-1-stephen@networkplumber.org>
In commit 80da7efbb4c4 ("eal: annotate allocation functions")
helper macros were added to provide compiler information to
detect misuse of alloc/free combinations. This covered many
of the functions in DPDK but missed the case of data allocated
by BPF load functions.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/bpf/rte_bpf.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/bpf/rte_bpf.h b/lib/bpf/rte_bpf.h
index 80ebb0210f..309d84bc51 100644
--- a/lib/bpf/rte_bpf.h
+++ b/lib/bpf/rte_bpf.h
@@ -18,6 +18,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_malloc.h>
#include <bpf_def.h>
#ifdef __cplusplus
@@ -128,7 +129,8 @@ rte_bpf_destroy(struct rte_bpf *bpf);
* - ENOMEM - can't reserve enough memory
*/
struct rte_bpf *
-rte_bpf_load(const struct rte_bpf_prm *prm);
+rte_bpf_load(const struct rte_bpf_prm *prm)
+ __rte_malloc __rte_dealloc(rte_bpf_destroy, 1);
/**
* Create a new eBPF execution context and load BPF code from given ELF
@@ -152,7 +154,9 @@ rte_bpf_load(const struct rte_bpf_prm *prm);
*/
struct rte_bpf *
rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
- const char *sname);
+ const char *sname)
+ __rte_malloc __rte_dealloc(rte_bpf_destroy, 1);
+
/**
* Execute given BPF bytecode.
*
@@ -228,7 +232,8 @@ struct bpf_program;
* - ENOTSUP - operation not supported
*/
struct rte_bpf_prm *
-rte_bpf_convert(const struct bpf_program *prog);
+rte_bpf_convert(const struct bpf_program *prog)
+ __rte_malloc __rte_dealloc_free;
#ifdef __cplusplus
}
--
2.51.0
next prev parent reply other threads:[~2025-11-01 18:07 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 17:34 [PATCH 0/5] bpf enhancements Stephen Hemminger
2025-10-30 17:34 ` [PATCH 1/5] bpf: add allocation annotations to functions Stephen Hemminger
2025-10-30 17:34 ` [PATCH 2/5] bpf: use rte_pktmbuf_free_bulk Stephen Hemminger
2025-10-30 17:34 ` [PATCH 3/5] bpf: add a test for BPF ELF load Stephen Hemminger
2025-10-30 17:34 ` [PATCH 4/5] bpf: add test for rx and tx filtering Stephen Hemminger
2025-10-30 17:34 ` [PATCH 5/5] bpf: remove use of vla Stephen Hemminger
2025-10-31 11:39 ` [PATCH 0/5] bpf enhancements Marat Khalili
2025-10-31 16:37 ` Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 0/5] BPF enhancements Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 1/5] bpf: add allocation annotations to functions Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 2/5] bpf: use bulk free on filtered packets Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 3/5] bpf: add a test for BPF ELF load Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 4/5] bpf: add test for Rx and Tx filtering Stephen Hemminger
2025-10-31 16:41 ` [PATCH v2 5/5] bpf: remove use of VLA Stephen Hemminger
2025-11-01 18:04 ` [PATCH v3 0/5] BPF enhancements Stephen Hemminger
2025-11-01 18:04 ` Stephen Hemminger [this message]
2025-11-02 21:42 ` [PATCH v3 1/5] bpf: add allocation annotations to functions Konstantin Ananyev
2025-11-01 18:04 ` [PATCH v3 2/5] bpf: use bulk free on filtered packets Stephen Hemminger
2025-11-01 18:04 ` [PATCH v3 3/5] bpf: add a test for BPF ELF load Stephen Hemminger
2025-11-01 18:04 ` [PATCH v3 4/5] bpf: add test for Rx and Tx filtering Stephen Hemminger
2025-11-01 18:04 ` [PATCH v3 5/5] bpf: remove use of VLA Stephen Hemminger
2025-11-03 9:21 ` Konstantin Ananyev
2025-11-04 16:07 ` [PATCH v4 0/5] BPF enhancements Stephen Hemminger
2025-11-04 16:07 ` [PATCH v4 1/5] bpf: add allocation annotations to functions Stephen Hemminger
2025-11-07 17:35 ` Marat Khalili
2025-11-04 16:07 ` [PATCH v4 2/5] bpf: use bulk free on filtered packets Stephen Hemminger
2025-11-06 7:25 ` Konstantin Ananyev
2025-11-07 17:36 ` Marat Khalili
2025-11-04 16:07 ` [PATCH v4 3/5] bpf: add a test for BPF ELF load Stephen Hemminger
2025-11-07 17:33 ` Marat Khalili
2025-11-07 17:45 ` Marat Khalili
2025-11-08 1:09 ` Stephen Hemminger
2025-11-10 15:34 ` Marat Khalili
2025-11-08 1:08 ` Stephen Hemminger
2025-11-04 16:07 ` [PATCH v4 4/5] bpf: add test for Rx and Tx filtering Stephen Hemminger
2025-11-07 17:30 ` Marat Khalili
2025-11-08 1:11 ` Stephen Hemminger
2025-11-10 15:43 ` Marat Khalili
2025-11-04 16:07 ` [PATCH v4 5/5] bpf: replace use of VLA Stephen Hemminger
2025-11-06 7:26 ` Konstantin Ananyev
2025-11-07 17:36 ` Marat Khalili
2025-11-09 20:07 ` [PATCH v5 0/5] BPF cleanup and tests Stephen Hemminger
2025-11-09 20:07 ` [PATCH v5 1/5] bpf: add allocation annotations to functions Stephen Hemminger
2025-11-09 20:07 ` [PATCH v5 2/5] bpf: use bulk free on filtered packets Stephen Hemminger
2025-11-09 20:07 ` [PATCH v5 3/5] bpf: add a test for BPF ELF load Stephen Hemminger
2025-11-10 16:38 ` Marat Khalili
2025-11-10 17:07 ` Stephen Hemminger
2025-11-10 17:17 ` Marat Khalili
2025-11-10 17:08 ` Stephen Hemminger
2025-11-11 9:46 ` Marat Khalili
2025-11-09 20:07 ` [PATCH v5 4/5] bpf: add test for Rx and Tx filtering Stephen Hemminger
2025-11-11 9:46 ` Marat Khalili
2025-11-09 20:07 ` [PATCH v5 5/5] bpf: replace use of VLA Stephen Hemminger
2025-11-11 12:13 ` [PATCH v5 0/5] BPF cleanup and tests Thomas Monjalon
2025-11-11 22:55 ` [PATCH v6 0/2] BPF tests Stephen Hemminger
2025-11-11 22:55 ` [PATCH v6 1/2] bpf: add a test for BPF ELF load Stephen Hemminger
2025-11-12 15:06 ` Konstantin Ananyev
2025-11-11 22:55 ` [PATCH v6 2/2] bpf: add test for Rx and Tx filtering Stephen Hemminger
2025-11-12 15:08 ` Konstantin Ananyev
2025-11-12 15:03 ` [PATCH v6 0/2] BPF tests Marat Khalili
2025-11-19 3:54 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251101180659.43883-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.