]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix libbpf hashmap on (I)LP32 architectures
authorJakub Bogusz <qboosh@pld-linux.org>
Thu, 9 Jul 2020 22:57:23 +0000 (15:57 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 10 Jul 2020 02:38:55 +0000 (19:38 -0700)
commit31c106c8182d7899570cd6d9ce6e63d8216b54bb
tree2e875e49560069cea681049e70f0dc7ec38ca24c
parente450c932090d612c3915690d563030217b4ddb2d
libbpf: Fix libbpf hashmap on (I)LP32 architectures

On ILP32, 64-bit result was shifted by value calculated for 32-bit long type
and returned value was much outside hashmap capacity.
As advised by Andrii Nakryiko, this patch uses different hashing variant for
architectures with size_t shorter than long long.

Fixes: efdc6bf14995 ("libbpf: add resizable non-thread safe internal hashmap")
Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200709225723.1069937-1-andriin@fb.com
tools/lib/bpf/hashmap.h