aboutsummaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorDan Carpenter2019-02-28 21:06:47 +0300
committerDaniel Borkmann2019-03-01 00:56:06 +0100
commit3d8669e63751b7a3f8fac109cd350c5f6c14e3e1 (patch)
tree04497c7d1d7d77256cbec1afa54d4dc55ac2b510 /tools/lib
parent74b388190874ecf718e488825e9268d5ff8f2631 (diff)
tools/libbpf: signedness bug in btf_dedup_ref_type()
The "ref_type_id" variable needs to be signed for the error handling to work. Fixes: d5caef5b5655 ("btf: add BTF types deduplication algorithm") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/btf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 68b50e9bbde1..00a2f06e38fd 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -2326,7 +2326,8 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id)
struct btf_type *t, *cand;
/* if we don't find equivalent type, then we are representative type */
__u32 new_id = type_id;
- __u32 h, ref_type_id;
+ int ref_type_id;
+ __u32 h;
if (d->map[type_id] == BTF_IN_PROGRESS_ID)
return -ELOOP;