Skip to content

Commit 2c8b09a

Browse files
SidongYangAlexei Starovoitov
authored andcommitted
libbpf: Change hash_combine parameters from long to unsigned long
The hash_combine() could be trapped when compiled with sanitizer like "zig cc" or clang with signed-integer-overflow option. This patch parameters and return type to unsigned long to remove the potential overflow. Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai> Acked-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20241116081054.65195-1-sidong.yang@furiosa.ai Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 608e99f commit 2c8b09a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/btf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3548,7 +3548,7 @@ struct btf_dedup {
35483548
struct strset *strs_set;
35493549
};
35503550

3551-
static long hash_combine(long h, long value)
3551+
static unsigned long hash_combine(unsigned long h, unsigned long value)
35523552
{
35533553
return h * 31 + value;
35543554
}

0 commit comments

Comments
 (0)