[DTrace-devel] [PATCH 3/6] Check if the BPF PROG_LOAD is either -1 or else non-negative

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Mar 31 01:02:21 UTC 2026


From: Eugene Loh <eugene.loh at oracle.com>

The return value is supposed to be -1 or non-negative.  The current
check lumps 0 with -1.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/dt_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
index fb66bd93b..c328f5100 100644
--- a/libdtrace/dt_bpf.c
+++ b/libdtrace/dt_bpf.c
@@ -428,7 +428,7 @@ have_helper(uint32_t func_id)
 	/* If the program loads, we can use the helper. */
 	fd = dt_bpf_prog_attach(BPF_PROG_TYPE_KPROBE, 0, 0, 0, &dp,
 			      1, log, DT_BPF_LOG_SIZE_SMALL);
-	if (fd > 0) {
+	if (fd >= 0) {
 		close(fd);
 		return 1;
 	}
-- 
2.47.3




More information about the DTrace-devel mailing list