]> git.baikalelectronics.ru Git - kernel.git/commit
bpftool: Check for NULL ptr of btf in codegen_asserts
authorMichael Mullin <masmullin@gmail.com>
Mon, 23 May 2022 19:49:17 +0000 (15:49 -0400)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 2 Jun 2022 23:26:43 +0000 (16:26 -0700)
commit0df934c7b42d00cc7fff79a3bbc5a7bbccff9bf2
tree1b795412ac72bdd5858073682f4b274b6d93d629
parent8ef4503fcb0ac132b176b3f18be85e3267e9eaf2
bpftool: Check for NULL ptr of btf in codegen_asserts

bpf_object__btf() can return a NULL value.  If bpf_object__btf returns
null, do not progress through codegen_asserts(). This avoids a null ptr
dereference at the call btf__type_cnt() in the function find_type_for_map()

Signed-off-by: Michael Mullin <masmullin@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220523194917.igkgorco42537arb@jup
tools/bpf/bpftool/gen.c