From a20afdc845f4e901f7d3e6974e59a0dc2e8bf427 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Tue, 14 Feb 2023 12:34:29 +0500 Subject: vppinfra: fix clib_bitmap_will_expand() result inversion Pool's pool_put_will_expand() calls clib_bitmap_will_expand(), so every put except ones that leads to free_bitmap reallocation will get false positive results and vice versa. Unfortunatelly there's no related test and existing bitmap tests are failing silently with false positive result as well. Fortunatelly neither clib_bitmap_will_expand() nor pool_put_will_expand() are being used by current vpp codebase. Type: fix Signed-off-by: Vladislav Grishenko Change-Id: Id5bb900cf6a1b1002d37670f5c415c74165b5421 --- src/vppinfra/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vppinfra/bitmap.h') diff --git a/src/vppinfra/bitmap.h b/src/vppinfra/bitmap.h index d579afd9979..abb1405d3a2 100644 --- a/src/vppinfra/bitmap.h +++ b/src/vppinfra/bitmap.h @@ -208,7 +208,7 @@ clib_bitmap_set (uword * ai, uword i, uword value) always_inline u8 clib_bitmap_will_expand (uword *ai, uword i) { - return (i / BITS (ai[0])) < vec_max_len (ai); + return (i / BITS (ai[0])) >= vec_max_len (ai); } /** Gets the ith bit value from a bitmap -- cgit 1.2.3-korg