From: Andrii Nakryiko Date: Tue, 29 Sep 2020 22:06:02 +0000 (-0700) Subject: libbpf: Fix uninitialized variable in btf_parse_type_sec X-Git-Tag: v5.10.7~1401^2~96^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33433913459a6bfbfa808c202d6f5490aa43d7a7;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Alexei Starovoitov Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/bpf/20200929220604.833631-1-andriin@fb.com --- diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index e1dbd76..398b1f3 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