Skip to content

Commit

Permalink
tools/libbpf: Avoid possibly using uninitialized variable
Browse files Browse the repository at this point in the history
Fixes a GCC maybe-uninitialized warning introduced by 48cca7e.
"text" is only initialized inside the if statement so only print debug
info there.

Fixes: 48cca7e ("libbpf: add support for bpf_call")
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Jeremy Cline authored and Daniel Borkmann committed Feb 20, 2018
1 parent 9c2d63b commit b1a2ce8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b1a2ce8

Please sign in to comment.