diff options
author | Alexei Starovoitov <ast@kernel.org> | 2019-03-27 08:01:25 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-03-27 08:01:26 -0700 |
commit | 369b976d6f3613518de1295bd2dee81fb255946d (patch) | |
tree | f8856c7d8beb7af4e1f48b0d29f81ddff7389ece /tools/lib | |
parent | f52c97d9df983cc38a8809d0910e5eaba0c180b3 (diff) | |
parent | eb76899ce749507e09cad6816f32cede14a9b7ee (diff) | |
download | linux-369b976d6f3613518de1295bd2dee81fb255946d.tar.bz2 |
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.c | 3 |
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); |