[PATCH] bpf: use initializer for dtrace_difo_t *dp
Kris Van Hees <[email protected]> Fri, 9 Jan 2026 16:10:50 -0500
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
Signed-off-by: Kris Van Hees <[email protected]> --- libdtrace/dt_bpf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c index 82a73414..20365855 100644 --- a/libdtrace/dt_bpf.c +++ b/libdtrace/dt_bpf.c @@ -422,12 +422,9 @@ have_helper(uint32_t func_id) BPF_CALL_HELPER(func_id), BPF_RETURN() }; - dtrace_difo_t dp; + dtrace_difo_t dp = { insns, NULL, NULL, ARRAY_SIZE(insns) }; int fd; - dp.dtdo_buf = insns; - dp.dtdo_len = ARRAY_SIZE(insns); - /* 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); @@ -486,12 +483,9 @@ have_attach_type(enum bpf_prog_type ptype, enum bpf_attach_type atype, BPF_MOV_IMM(BPF_REG_0, 0), BPF_RETURN() }; - dtrace_difo_t dp; + dtrace_difo_t dp = { insns, NULL, NULL, ARRAY_SIZE(insns) }; int pfd, tfd = -1; - dp.dtdo_buf = insns; - dp.dtdo_len = ARRAY_SIZE(insns); - pfd = dt_bpf_prog_attach(ptype, atype, 0, btf_id, &dp, 0, NULL, 0); /* If the program load fails, we cannot iuse the attach type. */ if (pfd < 0) -- 2.51.0