[PATCH 3/6] Check if the BPF PROG_LOAD is either -1 or else non-negative
[email protected] Mon, 30 Mar 2026 21:02:21 -0400
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
From: Eugene Loh <[email protected]> The return value is supposed to be -1 or non-negative. The current check lumps 0 with -1. Signed-off-by: Eugene Loh <[email protected]> --- 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