From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 3/6] Check if the BPF PROG_LOAD is either -1 or else non-negative
Date: Mon, 30 Mar 2026 21:02:21 -0400 [thread overview]
Message-ID: <20260331010224.16165-3-eugene.loh@oracle.com> (raw)
In-Reply-To: <20260331010224.16165-1-eugene.loh@oracle.com>
From: Eugene Loh <eugene.loh@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@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
next prev parent reply other threads:[~2026-03-31 1:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 1:02 [PATCH 1/6] test: Skip tst.depth.sh eugene.loh
2026-03-31 1:02 ` [PATCH 2/6] Simple typo in comment eugene.loh
2026-03-31 1:02 ` eugene.loh [this message]
2026-03-31 1:02 ` [PATCH 4/6] test: Remove unnecessary "destructive" pragma eugene.loh
2026-03-31 1:02 ` [PATCH 5/6] Possible uninitialized 'last' variable in usdt_copyin_data() eugene.loh
2026-03-31 1:02 ` [PATCH 6/6] test: Check declaration (without init) inside a probe eugene.loh
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=20260331010224.16165-3-eugene.loh@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox