@@ -585,6 +585,30 @@ static void __init test_bitmap_arr32(void)
585
585
}
586
586
}
587
587
588
+ static void __init test_bitmap_arr64 (void )
589
+ {
590
+ unsigned int nbits , next_bit ;
591
+ u64 arr [EXP1_IN_BITS / 64 ];
592
+ DECLARE_BITMAP (bmap2 , EXP1_IN_BITS );
593
+
594
+ memset (arr , 0xa5 , sizeof (arr ));
595
+
596
+ for (nbits = 0 ; nbits < EXP1_IN_BITS ; ++ nbits ) {
597
+ memset (bmap2 , 0xff , sizeof (arr ));
598
+ bitmap_to_arr64 (arr , exp1 , nbits );
599
+ bitmap_from_arr64 (bmap2 , arr , nbits );
600
+ expect_eq_bitmap (bmap2 , exp1 , nbits );
601
+
602
+ next_bit = find_next_bit (bmap2 , round_up (nbits , BITS_PER_LONG ), nbits );
603
+ if (next_bit < round_up (nbits , BITS_PER_LONG ))
604
+ pr_err ("bitmap_copy_arr64(nbits == %d:"
605
+ " tail is not safely cleared: %d\n" , nbits , next_bit );
606
+
607
+ if (nbits < EXP1_IN_BITS - 64 )
608
+ expect_eq_uint (arr [DIV_ROUND_UP (nbits , 64 )], 0xa5a5a5a5 );
609
+ }
610
+ }
611
+
588
612
static void noinline __init test_mem_optimisations (void )
589
613
{
590
614
DECLARE_BITMAP (bmap1 , 1024 );
@@ -852,6 +876,7 @@ static void __init selftest(void)
852
876
test_copy ();
853
877
test_replace ();
854
878
test_bitmap_arr32 ();
879
+ test_bitmap_arr64 ();
855
880
test_bitmap_parse ();
856
881
test_bitmap_parselist ();
857
882
test_bitmap_printlist ();
0 commit comments