diff options
author | Alexei Starovoitov <ast@kernel.org> | 2024-08-22 18:27:59 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-08-22 18:48:44 +0200 |
commit | 50c374c6d1a43db9444cb74cc09552c817db2a9b (patch) | |
tree | b80c7befe92ef07799cf2dca3135afe56a6a646f /tools/lib | |
parent | Merge branch 'support-bpf_fastcall-patterns-for-calls-to-kfuncs' (diff) | |
parent | Merge tag 'platform-drivers-x86-v6.11-4' of git://git.kernel.org/pub/scm/linu... (diff) | |
download | linux-50c374c6d1a43db9444cb74cc09552c817db2a9b.tar.xz linux-50c374c6d1a43db9444cb74cc09552c817db2a9b.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Cross-merge bpf fixes after downstream PR including
important fixes (from bpf-next point of view):
commit 41c24102af7b ("selftests/bpf: Filter out _GNU_SOURCE when compiling test_cpp")
commit fdad456cbcca ("bpf: Fix updating attached freplace prog in prog_array map")
No conflicts.
Adjacent changes in:
include/linux/bpf_verifier.h
kernel/bpf/verifier.c
tools/testing/selftests/bpf/Makefile
Link: https://lore.kernel.org/bpf/20240813234307.82773-1-alexei.starovoitov@gmail.com/
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bitmap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/lib/bitmap.c b/tools/lib/bitmap.c index c3e4871967bc..2178862bb114 100644 --- a/tools/lib/bitmap.c +++ b/tools/lib/bitmap.c @@ -100,3 +100,23 @@ bool __bitmap_intersects(const unsigned long *bitmap1, return true; return false; } + +void __bitmap_clear(unsigned long *map, unsigned int start, int len) +{ + unsigned long *p = map + BIT_WORD(start); + const unsigned int size = start + len; + int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); + unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); + + while (len - bits_to_clear >= 0) { + *p &= ~mask_to_clear; + len -= bits_to_clear; + bits_to_clear = BITS_PER_LONG; + mask_to_clear = ~0UL; + p++; + } + if (len) { + mask_to_clear &= BITMAP_LAST_WORD_MASK(size); + *p &= ~mask_to_clear; + } +} |