All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/libbpf: Avoid possibly using uninitialized variable
@ 2018-02-20  1:00 Jeremy Cline
  2018-02-20 20:32 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Cline @ 2018-02-20  1:00 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, linux-kernel, Jeremy Cline

Fixes a GCC maybe-uninitialized warning introduced by 48cca7e44f9f.
"text" is only initialized inside the if statement so only print debug
info there.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
---
 tools/lib/bpf/libbpf.c | 5 +++--
 1 file 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;
 }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/libbpf: Avoid possibly using uninitialized variable
  2018-02-20  1:00 [PATCH] tools/libbpf: Avoid possibly using uninitialized variable Jeremy Cline
@ 2018-02-20 20:32 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2018-02-20 20:32 UTC (permalink / raw)
  To: Jeremy Cline, Alexei Starovoitov; +Cc: netdev, linux-kernel

On 02/20/2018 02:00 AM, Jeremy Cline wrote:
> Fixes a GCC maybe-uninitialized warning introduced by 48cca7e44f9f.
> "text" is only initialized inside the if statement so only print debug
> info there.
> 
> Signed-off-by: Jeremy Cline <jeremy@jcline.org>

Looks good, applied to bpf tree, thanks Jeremy!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-20 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-20  1:00 [PATCH] tools/libbpf: Avoid possibly using uninitialized variable Jeremy Cline
2018-02-20 20:32 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.