]> Git Repo - J-linux.git/commitdiff
libbpf: Change hash_combine parameters from long to unsigned long
authorSidong Yang <[email protected]>
Sat, 16 Nov 2024 08:10:52 +0000 (17:10 +0900)
committerAlexei Starovoitov <[email protected]>
Sat, 16 Nov 2024 19:01:38 +0000 (11:01 -0800)
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]>
tools/lib/bpf/btf.c

index 8befb8103e32dbb26cbb33269bee94007e5f7656..12468ae0d573d7a150269f4a692761d3742af58e 100644 (file)
@@ -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;
 }
This page took 0.052571 seconds and 4 git commands to generate.