BPF List
 help / color / mirror / Atom feed
* [RFC PATCH] libbpf: Change hash_combine parameters from long to __u32
@ 2024-11-15 10:34 Sidong Yang
  2024-11-15 19:57 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Sidong Yang @ 2024-11-15 10:34 UTC (permalink / raw)
  To: Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	bpf, linux-kernel
  Cc: Sidong Yang

The hash_combine() could be trapped when compiled with sanitizer like "zig cc".
This patch changes parameters to __u32 to fix it.

Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 tools/lib/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 8befb8103e32..11ccb5aa4958 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 __u32 hash_combine(__u32 h, __u32 value)
 {
 	return h * 31 + value;
 }
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-16  6:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 10:34 [RFC PATCH] libbpf: Change hash_combine parameters from long to __u32 Sidong Yang
2024-11-15 19:57 ` Andrii Nakryiko
2024-11-16  0:36   ` Sidong Yang
2024-11-16  4:39     ` Yonghong Song
2024-11-16  6:49       ` Sidong Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox