diff mbox series

[04/16] lib/test_bitmap: test test_bitmap_arr{32,64} starting from nbits == 1

Message ID 20220718192844.1805158-5-yury.norov@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series Introduce DEBUG_BITMAP config option and bitmap_check_params() | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Yury Norov July 18, 2022, 7:28 p.m. UTC
nbits == 0 is useless. In a real code it's most probably a sign of
error, and it makes CONFIG_DEBUG_BITMAP barking.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 lib/test_bitmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko July 18, 2022, 9:09 p.m. UTC | #1
On Mon, Jul 18, 2022 at 12:28:32PM -0700, Yury Norov wrote:
> nbits == 0 is useless. In a real code it's most probably a sign of
> error, and it makes CONFIG_DEBUG_BITMAP barking.

Ditto as per previous patch.
diff mbox series

Patch

diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 2a70393ac011..bc48d992d10d 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -567,7 +567,7 @@  static void __init test_bitmap_arr32(void)
 
 	memset(arr, 0xa5, sizeof(arr));
 
-	for (nbits = 0; nbits < EXP1_IN_BITS; ++nbits) {
+	for (nbits = 1; nbits < EXP1_IN_BITS; ++nbits) {
 		bitmap_to_arr32(arr, exp1, nbits);
 		bitmap_from_arr32(bmap2, arr, nbits);
 		expect_eq_bitmap(bmap2, exp1, nbits);
@@ -593,7 +593,7 @@  static void __init test_bitmap_arr64(void)
 
 	memset(arr, 0xa5, sizeof(arr));
 
-	for (nbits = 0; nbits < EXP1_IN_BITS; ++nbits) {
+	for (nbits = 1; nbits < EXP1_IN_BITS; ++nbits) {
 		memset(bmap2, 0xff, sizeof(arr));
 		bitmap_to_arr64(arr, exp1, nbits);
 		bitmap_from_arr64(bmap2, arr, nbits);