aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/lib
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2019-03-27 08:01:25 -0700
committerAlexei Starovoitov <ast@kernel.org>2019-03-27 08:01:26 -0700
commit369b976d6f3613518de1295bd2dee81fb255946d (patch)
treef8856c7d8beb7af4e1f48b0d29f81ddff7389ece /tools/lib
parentbpf, doc: fix BTF docs reflow of bullet list (diff)
parentselftests/bpf: add btf_dedup test for VOID equivalence check (diff)
downloadwireguard-linux-369b976d6f3613518de1295bd2dee81fb255946d.tar.xz
wireguard-linux-369b976d6f3613518de1295bd2dee81fb255946d.zip
Merge branch 'fix-btf_dedup'
Andrii Nakryiko says: ==================== This patch set fixes bug in btf_dedup_is_equiv() check mishandling equivalence comparison between VOID kind in candidate type graph versus anonymous non-VOID kind in canonical type graph. Patch #1 fixes bug, by comparing candidate and canonical kinds for equality, before proceeding to kind-specific checks. Patch #2 adds a test case testing this specific scenario. ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/btf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 87e3020ac1bc..cf119c9b6f27 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -2107,6 +2107,9 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id,
return fwd_kind == real_kind;
}
+ if (cand_kind != canon_kind)
+ return 0;
+
switch (cand_kind) {
case BTF_KIND_INT:
return btf_equal_int(cand_type, canon_type);