summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2020-09-30 00:06:02 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-09-30 02:05:31 +0200
commit33433913459a6bfbfa808c202d6f5490aa43d7a7 (patch)
tree0515bfeedca7be6f4ddeef1b0de9f59a4bf4421f /tools
parentMerge branch 'bpf, x64: optimize JIT's pro/epilogue' (diff)
downloadlinux-33433913459a6bfbfa808c202d6f5490aa43d7a7.tar.xz
linux-33433913459a6bfbfa808c202d6f5490aa43d7a7.zip
libbpf: Fix uninitialized variable in btf_parse_type_sec
Fix obvious unitialized variable use that wasn't reported by compiler. libbpf Makefile changes to catch such errors are added separately. Fixes: 3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness") Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20200929220604.833631-1-andriin@fb.com
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/btf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index e1dbd766c698..398b1f345b3c 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -347,7 +347,7 @@ static int btf_parse_type_sec(struct btf *btf)
struct btf_header *hdr = btf->hdr;
void *next_type = btf->types_data;
void *end_type = next_type + hdr->type_len;
- int err, i, type_size;
+ int err, i = 0, type_size;
/* VOID (type_id == 0) is specially handled by btf__get_type_by_id(),
* so ensure we can never properly use its offset from index by