aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSidong Yang <[email protected]>2024-11-16 17:10:52 +0900
committerAlexei Starovoitov <[email protected]>2024-11-16 11:01:38 -0800
commit2c8b09ac2537299511c898bc71b1a5f2756c831c (patch)
tree4cb993bba29d1c359464be75aec36cc9af15a04e
parent608e99f7869e3a6e028c7cba14a896c7797e8746 (diff)
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 <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
-rw-r--r--tools/lib/bpf/btf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 8befb8103e32..12468ae0d573 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;
}