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>
This commit is contained in:
Sidong Yang
2025-01-08 14:58:04 -08:00
committed by Andrii Nakryiko
parent 05333afec1
commit b1f223b5b8
+1 -1
View File
@@ -3548,7 +3548,7 @@ struct btf_dedup {
struct strset *strs_set; struct strset *strs_set;
}; };
static long hash_combine(long h, long value) static unsigned long hash_combine(unsigned long h, unsigned long value)
{ {
return h * 31 + value; return h * 31 + value;
} }