tools/libbpf: signedness bug in btf_dedup_ref_type()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 28 Feb 2019 18:06:47 +0000 (21:06 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 28 Feb 2019 23:56:06 +0000 (00:56 +0100)
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>
tools/lib/bpf/btf.c

index 68b50e9..00a2f06 100644 (file)
@@ -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;