From: Sidong Yang Date: Sat, 16 Nov 2024 08:10:52 +0000 (+0900) Subject: libbpf: Change hash_combine parameters from long to unsigned long X-Git-Tag: v6.13-rc1~136^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c8b09ac2537299511c898bc71b1a5f2756c831c;p=thirdparty%2Fkernel%2Flinux.git 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 Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20241116081054.65195-1-sidong.yang@furiosa.ai Signed-off-by: Alexei Starovoitov --- diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 8befb8103e32d..12468ae0d573d 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -3548,7 +3548,7 @@ struct btf_dedup { 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; }