summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorJeremy Cline <jeremy@jcline.org>2018-02-20 01:00:07 +0000
committerDaniel Borkmann <daniel@iogearbox.net>2018-02-20 21:08:20 +0100
commitb1a2ce825737b0165cc08e6f98f8c0ea1affdd60 (patch)
treeb5b9b483a0803953aaa1c490cc3186c4d150599b /tools/lib
parent9c2d63b843a5c8a8d0559cc067b5398aa5ec3ffc (diff)
tools/libbpf: Avoid possibly using uninitialized variable
Fixes a GCC maybe-uninitialized warning introduced by 48cca7e44f9f. "text" is only initialized inside the if statement so only print debug info there. Fixes: 48cca7e44f9f ("libbpf: add support for bpf_call") Signed-off-by: Jeremy Cline <jeremy@jcline.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/libbpf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 97073d649c1a..5bbbf285af74 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1060,11 +1060,12 @@ bpf_program__reloc_text(struct bpf_program *prog, struct bpf_object *obj,
prog->insns = new_insn;
prog->main_prog_cnt = prog->insns_cnt;
prog->insns_cnt = new_cnt;
+ pr_debug("added %zd insn from %s to prog %s\n",
+ text->insns_cnt, text->section_name,
+ prog->section_name);
}
insn = &prog->insns[relo->insn_idx];
insn->imm += prog->main_prog_cnt - relo->insn_idx;
- pr_debug("added %zd insn from %s to prog %s\n",
- text->insns_cnt, text->section_name, prog->section_name);
return 0;
}